Facter.to_hash does not seem to return all facts
neoice opened this issue · 4 comments
when I call this manually, I get 26 elements back. my mcollective "facts" file is 31 lines.
my actual facter output is 95 lines. somehow, more than half of my facts are not available to mcollective :(
I must not have been root to get that level of inconsistency, not sure how I didn't notice that.
there's still inconsistencies as root:
irb(main):007:0> Facter.to_hash.length
=> 85
# facter -p | wc -l
99
it looks like module-provided facts do not show up in my /etc/mcollective/facts.yaml. one example, I should get facts about the puppet-managed Java runtime:
# facter -p | grep java
java_major_version => 8
java_patch_level => 51
java_version => 1.8.0_51
# cat /etc/mcollective/facts.yaml | grep -i java
# no results
Facter::Application.load_puppet
should be equivalent to facter -p
but it appears to be missing something.
I noticed this because I deployed a custom fact in a Puppet module and then expected to slice&dice my mcollective nodes based on that fact.
irb(main):003:0> Facter::Application.load_puppet
Could not load Puppet: no such file to load -- json
I needed package ruby-json
(even though I already have rubygems-json
)
the "could not load" doesnt trigger an exception so execution completes with incomplete data. a successful load and a failed load both seem to return nil
, so I'm not sure what condition could be checked to raise the error.
wow. that's a messed up chain of inconsistencies 👎
thank you very much for getting to the bottom of this.
it seems to be this should be a bug in the packaging.
not quite sure if in facter's or in mcollective's though.
would you mind submitting that to puppetlabs' jira?
for one, for the other, the issue where json fails to load is because the loading of json isn't a hard dependency… which, i believe, it should be…