| Puppet Version: PE 2016.4.5 Puppet Server Version: 2016.4.5** OS Name/Version: RHEL 6.4 When using "puppet apply" to locally smoke-test updates to an existing and already "deployed" module, everything works properly except when the module happens to also contain an updated custom fact. The updated custom fact never gets loaded; instead, "puppet apply" always reads from the pluginsync'ed cache, regardless of "modulepath" setting. (In this particular case, the custom fact update added support for a second operating system via a small change to the confine directive.) The module autoload seems to be pretty deterministic and follows the modulepath (user-definable), so why wouldn’t fact loading do the same? Since “puppet apply” is totally disconnected and unaware of any master anyway, why does it bother loading custom facts from the cache since it really should not count on them being there in the first place? It should be able to get them all via dependencies in “modulepath”. Proposed workarounds were to delete the old fact from the cache under /opt/puppetlabs/puppet/cache (which works until pluginsync kicks in again), rename the module and fact under test (kludgey, prone to error, and does not test code as-is; and not conducive to integration testing). Steps to reproduce (transcribed–not from copy & paste): file { ‘/opt/softwaredir’: ensure => directory, owner => ‘root’, group => $::my_fact ? { /[a-zA-Z0-9]+/ => $::my_fact, default => undef, } , } <mymodule>/lib/facter/my_fact.rb getmyfact = “/usr/bin/groups <pick a user> | /usr/bin/tr ‘ ‘ ‘\012’ | /bin/egrep ‘^(<group1>|<group2>|<group3>)$’ | /usr/bin/head -1” Facter.add(:my_fact) do confine kernel: 'Solaris' setcode do Facter::Core::Execution.exec(getmyfact) end end UPDATE to custom fact: confine kernel: ['Solaris', 'Linux'] If you test on Linux, the fact never gets created because it is still 'Solaris'-only in the cache. However, "facter" --custom-dir ... works properly. Desired Behavior: Either "puppet apply" should ignore pluginsync'ed cache completely, write the new custom fact to the cache and use it, follow "modulepath" for loading custom facts, or have some sort of option/flag to override loading custom facts from cache. (The independent, master-oblivious "puppet apply" should use the files from the module under test, and pull from modulepath if not found.) Actual Behavior: "puppet apply" ignores updated custom fact file and reads old/stale data from cache. Log output is not possible, since systems exist in a closed environment (no Internet). |