| josh To be clear, what I observed and reported doesn't seem to be a facter issue. In fact, interestingly, facter by itself seem to have the inverse behavior as to what I saw versus when the facts are presented in Puppet. Given two Ruby facts, one simple fact which returns "nil" and one which returns a hash containing a single key with a nil value you get these results with the facter CLI:
- facter --version
3.14.17 (commit ce1f2bb4a91a1ac4ae5852091c96ae6ee3712e23)
- facter -p --json mysimplefact mystructuredfact
{ "mysimplefact": "", "mystructuredfact": { "mykey": null } }
Facter does the correct thing with the structured fact, but turns the simple fact nil value into a string. Now, those same Facts as presented by Puppet: Notice: mystructuredfact: {"mykey":""} Notice: mysimplefact: null Notice: mysimplefact is key in facts hash: false The value of the structured fact key is now the empty string, the simple fact value is now null, and on top of that the fact doesn't even get added to the $facts hash. The behavior I think we should have is that the data types returned by Facter should be preserved when used in Puppet. I think that a fact which returns nil as its only value should continue to not be present in the facts hash. At the very least, the behavior should be consistent between Puppet and Facter. You can see the quick module I put together for the above testing here: https://github.com/seanmil/facttest As an aside to this issue, Puppet type system support in facts would be awesome! |