Andriy Yurchuk
2013-Apr-26 05:06 UTC
[Puppet Users] Access facts values in Puppet provider
I''m writing a custom Puppet service provider and I need to access one of my facts value inside provider to then be able to use the value inside startcmd/stopcmd. There is a confine which can test whether a fact exists, but how do I actually get the value of the fact? -- 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?hl=en. For more options, visit https://groups.google.com/groups/opt_out.
jcbollinger
2013-Apr-26 13:20 UTC
[Puppet Users] Re: Access facts values in Puppet provider
On Friday, April 26, 2013 12:06:54 AM UTC-5, Andriy Yurchuk wrote:> > I''m writing a custom Puppet service provider and I need to access one of > my facts value inside provider to then be able to use the value inside > startcmd/stopcmd. There is a confine which can test whether a fact exists, > but how do I actually get the value of the fact? >As far as I know, providers do not have direct access to node facts. They run on the target node, not on the master, so they cannot draw data from the master''s environment unless it is provided to them via resource parameters. On the other hand, providers can (and often do) directly interact with the target node to obtain any information they need. Although it would be roundabout, your provider could probably even use Facter to (re-)compute the data you want. John -- 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?hl=en. For more options, visit https://groups.google.com/groups/opt_out.
Andriy Yurchuk
2013-Apr-26 14:23 UTC
[Puppet Users] Re: Access facts values in Puppet provider
Found out this can be done via Facter[''my_fact''].value On Friday, April 26, 2013 8:06:54 AM UTC+3, Andriy Yurchuk wrote:> > I''m writing a custom Puppet service provider and I need to access one of > my facts value inside provider to then be able to use the value inside > startcmd/stopcmd. There is a confine which can test whether a fact exists, > but how do I actually get the value of the fact? >-- 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?hl=en. For more options, visit https://groups.google.com/groups/opt_out.