So, I'm aiming to have a method of interpolating Facter facts in Hiera data files that works more or less exactly like the `scope` lookup function, except that if the Facter fact is not defined, this interpolation should result in Hiera moving on to the next hierarchy level as if the key were not found, rather than simply interpolating an empty string.
I've managed to make a rough hack of https://github.com/puppetlabs/puppet/blob/master/lib/puppet/pops/lookup/interpolation.rb that seems to accomplish what I'm looking for, but I'm not really sure how to work with Puppet's test infrastructure, nor whether this is really an idea the Puppet team would actually be interested in. My actual goal is to allow Jenkins to run the Puppet Agent on a CI node while setting an environment variable such as `FACTER_myapp_version`, and have a node-specific YAML file that reads `profile::myapp::version: "%{maybe('facts.myapp_version')}"`, and thus allow Jenkins to control the version of the app that gets deployed; at the same time, during a run which doesn't set that particular environment variable I'd want Hiera to continue looking in other hierarchy levels, not just say that profile::myapp::version is an empty string. And, I do want to control this in Hiera if at all possible, not using `pick($facts['myapp_version'],lookup('profile::myapp::version'))` in puppet code, or anything similar. So, I have three questions: 1. Is there an easier way to accomplish this that I'm not seeing, with a custom Hiera backend or something similar? 2. If not, is there a system for implementing custom interpolation functions as anything other than a patch to the `interpolation_method` method in lib/puppet/pops/lookup/interpolation.rb? (I couldn't find one, but that doesn't mean one doesn't exist) 3. If not, would anyone actually be interested in a pull request for this? Thanks, - Adam -- You received this message because you are subscribed to the Google Groups "Puppet Developers" group. To unsubscribe from this group and stop receiving emails from it, send an email to puppet-dev+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/puppet-dev/d361da94-f5ee-46fc-ae80-5bd896537697%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.