Creating custom facts: how to access the 'trusted' hash?
I'm setting up some custom facts in the modules/facts/lib/facter directory and I want to access the 'trusted' hash that contains the trusted/verified node data. However I can't seem to find a way to access that variable..is it available in that scope?
Here's what I'm trying to do:
Facter.add("mpenvironment2") do setcode do mpenv = trusted['certname'].split("-").last case mpenv when /qa/ "qa" when "prod" "prod" when "dev" "dev" when "stg" "stg" else mpenv end end end
but I get this error: Error: Facter: error while resolving custom fact "mpenvironment2": undefined local variable or method `trusted' for #<facter::util::resolution:0x00000004d35320> I'm using puppet-agent-1.2.5 and puppetserver-2.1.1