FAQ
Hi, all!

I'm trying to use external facts from Facter 1.7 and everything looks good:

web0 $ cat /etc/facter/facts.d/environment.txt
environment=productionweb0$
web0 $ facter environment
production
web0 # puppet agent -t
Info: Retrieving plugin
Info: Loading facts in /var/lib/puppet/lib/facter/puppet_vardir.rb
[...]
Notice: Environment name for web0 is production
[...]
Notice: Finished catalog run in 11.25 seconds

But one thing do not leave me in peace - I can't use this fact in PuppetDB
API queries, for some reasons it is not visible for PuppetDB:

$ curl -X GET -H 'Accept: application/json'
http://puppetdb:8080/v2/facts/environment
$

Is somebody have an experience with using facts in puppetdb queries? Is it
possible?

Thanks!

---
Alexander

--
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 puppet-users+unsubscribe@googlegroups.com.
To post to this group, send email to puppet-users@googlegroups.com.
Visit this group at http://groups.google.com/group/puppet-users.
For more options, visit https://groups.google.com/groups/opt_out.

Search Discussions

  • David Schmitt at Jun 20, 2013 at 6:57 am
    Hi, Alexander,

    "environment" is a special variable. It denotes the puppet environment
    that is used by the puppetmaster to multiplex into different module
    directories. While I have not tested this, I would assume that this is
    special cased by many code paths.

    Your own example shows that the environment is not honored by the puppet
    agent.

    Just use a different name for the variable and use it to set the
    environment in puppet.conf, if that's what you really want.


    Regards, David
    On 20.06.2013 08:46, Alexander Grushin wrote:
    Hi, all!

    I'm trying to use external facts from Facter 1.7 and everything looks good:

    web0 $ cat /etc/facter/facts.d/environment.txt
    environment=productionweb0$
    web0 $ facter environment
    production
    web0 # puppet agent -t
    Info: Retrieving plugin
    Info: Loading facts in /var/lib/puppet/lib/facter/puppet_vardir.rb
    [...]
    Notice: Environment name for web0 is production
    [...]
    Notice: Finished catalog run in 11.25 seconds

    But one thing do not leave me in peace - I can't use this fact in
    PuppetDB API queries, for some reasons it is not visible for PuppetDB:

    $ curl -X GET -H 'Accept: application/json'
    http://puppetdb:8080/v2/facts/environment
    $

    Is somebody have an experience with using facts in puppetdb queries? Is
    it possible?

    Thanks!

    ---
    Alexander

    --
    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 puppet-users+unsubscribe@googlegroups.com.
    To post to this group, send email to puppet-users@googlegroups.com.
    Visit this group at http://groups.google.com/group/puppet-users.
    For more options, visit https://groups.google.com/groups/opt_out.
    --
    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 puppet-users+unsubscribe@googlegroups.com.
    To post to this group, send email to puppet-users@googlegroups.com.
    Visit this group at http://groups.google.com/group/puppet-users.
    For more options, visit https://groups.google.com/groups/opt_out.
  • Alexander Grushin at Jun 20, 2013 at 7:13 am
    Yep, this was a cause.

    Great! Thanks, David!
    On Thursday, June 20, 2013 10:56:50 AM UTC+4, David Schmitt wrote:

    Hi, Alexander,

    "environment" is a special variable. It denotes the puppet environment
    that is used by the puppetmaster to multiplex into different module
    directories. While I have not tested this, I would assume that this is
    special cased by many code paths.

    Your own example shows that the environment is not honored by the puppet
    agent.

    Just use a different name for the variable and use it to set the
    environment in puppet.conf, if that's what you really want.


    Regards, David
    On 20.06.2013 08:46, Alexander Grushin wrote:
    Hi, all!

    I'm trying to use external facts from Facter 1.7 and everything looks good:
    web0 $ cat /etc/facter/facts.d/environment.txt
    environment=productionweb0$
    web0 $ facter environment
    production
    web0 # puppet agent -t
    Info: Retrieving plugin
    Info: Loading facts in /var/lib/puppet/lib/facter/puppet_vardir.rb
    [...]
    Notice: Environment name for web0 is production
    [...]
    Notice: Finished catalog run in 11.25 seconds

    But one thing do not leave me in peace - I can't use this fact in
    PuppetDB API queries, for some reasons it is not visible for PuppetDB:

    $ curl -X GET -H 'Accept: application/json'
    http://puppetdb:8080/v2/facts/environment
    $

    Is somebody have an experience with using facts in puppetdb queries? Is
    it possible?

    Thanks!

    ---
    Alexander

    --
    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 puppet-users...@googlegroups.com <javascript:>.
    To post to this group, send email to puppet...@googlegroups.com<javascript:>.
    Visit this group at http://groups.google.com/group/puppet-users.
    For more options, visit https://groups.google.com/groups/opt_out.
    --
    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 puppet-users+unsubscribe@googlegroups.com.
    To post to this group, send email to puppet-users@googlegroups.com.
    Visit this group at http://groups.google.com/group/puppet-users.
    For more options, visit https://groups.google.com/groups/opt_out.
  • Alexander Grushin at Jun 20, 2013 at 8:19 am
    Interesting...

    This fact returned using PuppetDB API query only after I run puppet agent
    -t manually.
    I believe this fact should appear after usual puppet agent daemon run
    (every 10 minutes), but it doesn't.

    And what is more interesting - those entries disappear after a while. Looks
    like some expiration procedure in action?

    $ curl -X GET -H 'Accept: application/json' http://puppetdb:8080/v2/facts
    --data-urlencode 'query=["=", "name", "appenvironment"]'
    [ {
       "certname" : "web0.local",
       "name" : "appenvironment",
       "value" : "production"
    }, {
       "certname" : "web98.local",
       "name" : "appenvironment",
       "value" : "production"
    }, {
       "certname" : "web99.local",
       "name" : "appenvironment",
       "value" : "production"
    } ]

    After a while:

    $ curl -X GET -H 'Accept: application/json' http://puppetdb:8080/v2/facts
    --data-urlencode 'query=["=", "name", "appenvironment"]'
    [ {
       "certname" : "web97.local",
       "name" : "appenvironment",
       "value" : "production"
    }, {
       "certname" : "web98.local",
       "name" : "appenvironment",
       "value" : "production"
    } ]

    And one more time:
    $ curl -X GET -H 'Accept: application/json' http://puppetdb:8080/v2/facts
    --data-urlencode 'query=["=", "name", "appenvironment"]'
    [ {
       "certname" : "web97.local",
       "name" : "appenvironment",
       "value" : "production"
    } ]

    --
    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 puppet-users+unsubscribe@googlegroups.com.
    To post to this group, send email to puppet-users@googlegroups.com.
    Visit this group at http://groups.google.com/group/puppet-users.
    For more options, visit https://groups.google.com/groups/opt_out.
  • David Schmitt at Jun 20, 2013 at 9:18 am
    Perhaps you have still an agent running who has loaded an older facter
    version?

    The default expiration of nodes in puppetdb should be in the order of
    days, if it is even enabled by default.


    Regards, D.
    On 20.06.2013 10:19, Alexander Grushin wrote:
    Interesting...

    This fact returned using PuppetDB API query only after I run puppet
    agent -t manually.
    I believe this fact should appear after usual puppet agent daemon run
    (every 10 minutes), but it doesn't.

    And what is more interesting - those entries disappear after a while.
    Looks like some expiration procedure in action?

    $ curl -X GET -H 'Accept: application/json'
    http://puppetdb:8080/v2/facts --data-urlencode 'query=["=", "name",
    "appenvironment"]'
    [ {
    "certname" : "web0.local",
    "name" : "appenvironment",
    "value" : "production"
    }, {
    "certname" : "web98.local",
    "name" : "appenvironment",
    "value" : "production"
    }, {
    "certname" : "web99.local",
    "name" : "appenvironment",
    "value" : "production"
    } ]

    After a while:

    $ curl -X GET -H 'Accept: application/json'
    http://puppetdb:8080/v2/facts --data-urlencode 'query=["=", "name",
    "appenvironment"]'
    [ {
    "certname" : "web97.local",
    "name" : "appenvironment",
    "value" : "production"
    }, {
    "certname" : "web98.local",
    "name" : "appenvironment",
    "value" : "production"
    } ]

    And one more time:
    $ curl -X GET -H 'Accept: application/json'
    http://puppetdb:8080/v2/facts --data-urlencode 'query=["=", "name",
    "appenvironment"]'
    [ {
    "certname" : "web97.local",
    "name" : "appenvironment",
    "value" : "production"
    } ]

    --
    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 puppet-users+unsubscribe@googlegroups.com.
    To post to this group, send email to puppet-users@googlegroups.com.
    Visit this group at http://groups.google.com/group/puppet-users.
    For more options, visit https://groups.google.com/groups/opt_out.
    --
    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 puppet-users+unsubscribe@googlegroups.com.
    To post to this group, send email to puppet-users@googlegroups.com.
    Visit this group at http://groups.google.com/group/puppet-users.
    For more options, visit https://groups.google.com/groups/opt_out.
  • Alexander Grushin at Jun 24, 2013 at 5:28 am
    You are right, thanks!

    Custom fact get disappearing because of periodic run of puppet agent with
    old facter. Restart solved this problem.
    On Thursday, June 20, 2013 1:18:09 PM UTC+4, David Schmitt wrote:

    Perhaps you have still an agent running who has loaded an older facter
    version?

    The default expiration of nodes in puppetdb should be in the order of
    days, if it is even enabled by default.


    Regards, D.
    On 20.06.2013 10:19, Alexander Grushin wrote:
    Interesting...

    This fact returned using PuppetDB API query only after I run puppet
    agent -t manually.
    I believe this fact should appear after usual puppet agent daemon run
    (every 10 minutes), but it doesn't.

    And what is more interesting - those entries disappear after a while.
    Looks like some expiration procedure in action?

    $ curl -X GET -H 'Accept: application/json'
    http://puppetdb:8080/v2/facts --data-urlencode 'query=["=", "name",
    "appenvironment"]'
    [ {
    "certname" : "web0.local",
    "name" : "appenvironment",
    "value" : "production"
    }, {
    "certname" : "web98.local",
    "name" : "appenvironment",
    "value" : "production"
    }, {
    "certname" : "web99.local",
    "name" : "appenvironment",
    "value" : "production"
    } ]

    After a while:

    $ curl -X GET -H 'Accept: application/json'
    http://puppetdb:8080/v2/facts --data-urlencode 'query=["=", "name",
    "appenvironment"]'
    [ {
    "certname" : "web97.local",
    "name" : "appenvironment",
    "value" : "production"
    }, {
    "certname" : "web98.local",
    "name" : "appenvironment",
    "value" : "production"
    } ]

    And one more time:
    $ curl -X GET -H 'Accept: application/json'
    http://puppetdb:8080/v2/facts --data-urlencode 'query=["=", "name",
    "appenvironment"]'
    [ {
    "certname" : "web97.local",
    "name" : "appenvironment",
    "value" : "production"
    } ]

    --
    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 puppet-users...@googlegroups.com <javascript:>.
    To post to this group, send email to puppet...@googlegroups.com<javascript:>.
    Visit this group at http://groups.google.com/group/puppet-users.
    For more options, visit https://groups.google.com/groups/opt_out.
    --
    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 puppet-users+unsubscribe@googlegroups.com.
    To post to this group, send email to puppet-users@googlegroups.com.
    Visit this group at http://groups.google.com/group/puppet-users.
    For more options, visit https://groups.google.com/groups/opt_out.
  • Haani Niyaz at Dec 14, 2014 at 8:52 am
    Hi there,

    I'm running into a similar probelm where the custom fact declaration file
    is disappearing when I run the puppet agent. What did you restart to
    resolve the problem?
    On Monday, 24 June 2013 15:28:41 UTC+10, Alexander Grushin wrote:

    You are right, thanks!

    Custom fact get disappearing because of periodic run of puppet agent with
    old facter. Restart solved this problem.
    On Thursday, June 20, 2013 1:18:09 PM UTC+4, David Schmitt wrote:

    Perhaps you have still an agent running who has loaded an older facter
    version?

    The default expiration of nodes in puppetdb should be in the order of
    days, if it is even enabled by default.


    Regards, D.
    On 20.06.2013 10:19, Alexander Grushin wrote:
    Interesting...

    This fact returned using PuppetDB API query only after I run puppet
    agent -t manually.
    I believe this fact should appear after usual puppet agent daemon run
    (every 10 minutes), but it doesn't.

    And what is more interesting - those entries disappear after a while.
    Looks like some expiration procedure in action?

    $ curl -X GET -H 'Accept: application/json'
    http://puppetdb:8080/v2/facts --data-urlencode 'query=["=", "name",
    "appenvironment"]'
    [ {
    "certname" : "web0.local",
    "name" : "appenvironment",
    "value" : "production"
    }, {
    "certname" : "web98.local",
    "name" : "appenvironment",
    "value" : "production"
    }, {
    "certname" : "web99.local",
    "name" : "appenvironment",
    "value" : "production"
    } ]

    After a while:

    $ curl -X GET -H 'Accept: application/json'
    http://puppetdb:8080/v2/facts --data-urlencode 'query=["=", "name",
    "appenvironment"]'
    [ {
    "certname" : "web97.local",
    "name" : "appenvironment",
    "value" : "production"
    }, {
    "certname" : "web98.local",
    "name" : "appenvironment",
    "value" : "production"
    } ]

    And one more time:
    $ curl -X GET -H 'Accept: application/json'
    http://puppetdb:8080/v2/facts --data-urlencode 'query=["=", "name",
    "appenvironment"]'
    [ {
    "certname" : "web97.local",
    "name" : "appenvironment",
    "value" : "production"
    } ]

    --
    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 puppet-users...@googlegroups.com.
    To post to this group, send email to puppet...@googlegroups.com.
    Visit this group at http://groups.google.com/group/puppet-users.
    For more options, visit https://groups.google.com/groups/opt_out.
    --
    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 puppet-users+unsubscribe@googlegroups.com.
    To view this discussion on the web visit https://groups.google.com/d/msgid/puppet-users/c4940b23-b6ee-4740-bc3e-3ada434ddea2%40googlegroups.com.
    For more options, visit https://groups.google.com/d/optout.

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
grouppuppet-users @
categoriespuppet
postedJun 20, '13 at 6:46a
activeDec 14, '14 at 8:52a
posts7
users3
websitepuppetlabs.com

People

Translate

site design / logo © 2022 Grokbase