'environment' is not a Fact:

laptop:~$ sudo facter -p environment
laptop:~$ 

It is a configuration parameter of Puppet. I'm not sure why older 2.7 hosts 
would be reporting it as a Fact to PuppetDB, unless in 2.7 all top scope 
variables were sent this way.

You could use a Fact to pull out what environment an Agent *would* run with 
using this Fact code:

#Get the configured environment out of puppet.conf
begin
    puppet_environment = ''

    File.open('/etc/puppet/puppet.conf').each do |line|
        if line =~ /^\s*environment\s*=\s*(\S+)/
            puppet_environment = $1
        end
    end

    Facter.add(:puppet_environment) do
        setcode do
            puppet_environment
        end
    end
rescue
    Facter.warn("puppet_environment.rb failed: #{$!}")
end


On Wednesday, December 4, 2013 10:04:53 AM UTC, [email protected] 
wrote:
>
> Hi,
>
> I'm seeing something rather strange with puppetdb (1.5.2) in regards to 
> the environment fact.
>
> On my puppetdb host:
>
> If I run the following query:
>
> curl -G 'http://localhost:8080/v3/facts' --data-urlencode 'query=["=", 
> "name", "environment"]'
>
> I would expect to receive the environment fact for every node that I'm 
> managing with puppet (>500).
>
> However, that query only returns 11 nodes.  These 11 nodes are running 
> puppet 2.7.22.
>
> I am in the process of upgrading puppet to 3.3.2 from 2.7.22.
>
> All of the nodes running 3.3.2 are missing the environment fact from 
> puppetdb.  All the 2.7.22 nodes have the environment fact stored.
>
> Can anyone think of a reason why the environment fact is missing for my 
> 3.3.2 nodes?
>
> J
>

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/puppet-users/8e47c15c-9395-4a74-8e61-da15ad433688%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to