I''m working with custom facts with facter 1.7.2. I''ve created a fact file with an ntp configuration fact in it: # grep ntp_conf /etc/facter/facts.d/myfacts.txt v_ntp__ntp_conf=puppet:///modules/ntp/DEFAULT/ntp_conf facter knows the fact is there: # facter -p v_ntp__ntp_conf puppet:///modules/ntp/DEFAULT/ntp_conf ...but puppet thinks the variable is undefined: # cat /tmp/notify.pp notify{$hardwaremodel:} notify{$v_ntp__ntp_conf:} [root@sazabi facts.d]# puppet apply /tmp/notify.pp Notice: x86_64 Notice: /Stage[main]//Notify[x86_64]/message: defined ''message'' as ''x86_64'' Notice: undef Notice: /Stage[main]//Notify[undef]/message: defined ''message'' as ''undef'' Notice: Finished catalog run in 0.28 seconds What am I missing here? Thanks! -- 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.
Hi, That looks a weird way of using facts. In my opinion that kind of detail should be in your puppet code, not your fact code. What I would push out as facts are things like:> v_ntp__ntp_conf=defaultAnd then use puppet code to manage the ''if $::v_ntp...'' (Notice top scope there for the fact variable). An alternative much better than this is to use Hiera. Now, why is puppet not seeing that fact, I honestly don''t know. Try different things like removing the puppet:/// schema and see if it works. Does a single word work without and forward slashes? But really, I don''t like the way your code is headed :) HTH Den On 11/09/2013, at 1:38, David Thompson <dthompson@waisman.wisc.edu> wrote:> I''m working with custom facts with facter 1.7.2. I''ve created a fact file with an ntp configuration fact in it: > > # grep ntp_conf /etc/facter/facts.d/myfacts.txt > puppet:///modules/ntp/DEFAULT/ntp_conf > > facter knows the fact is there: > > # facter -p v_ntp__ntp_conf > puppet:///modules/ntp/DEFAULT/ntp_conf > > ...but puppet thinks the variable is undefined: > > # cat /tmp/notify.pp > notify{$hardwaremodel:} > notify{$v_ntp__ntp_conf:} > [root@sazabi facts.d]# puppet apply /tmp/notify.pp > Notice: x86_64 > Notice: /Stage[main]//Notify[x86_64]/message: defined ''message'' as ''x86_64'' > Notice: undef > Notice: /Stage[main]//Notify[undef]/message: defined ''message'' as ''undef'' > Notice: Finished catalog run in 0.28 seconds > > What am I missing here? Thanks! > -- > 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.
David Thompson
2013-Sep-11 13:07 UTC
Re: [Puppet Users] Custom Fact undefined in manifests
On 9/10/13 5:49 PM, Denmat wrote:> On 11/09/2013, at 1:38, David Thompson <dthompson@waisman.wisc.edu > <mailto:dthompson@waisman.wisc.edu>> wrote: > >> I''m working with custom facts with facter 1.7.2. I''ve created a fact >> file with an ntp configuration fact in it: >> >> # grep ntp_conf /etc/facter/facts.d/myfacts.txt >> puppet:///modules/ntp/DEFAULT/ntp_conf >> >> facter knows the fact is there: >> >> # facter -p v_ntp__ntp_conf >> puppet:///modules/ntp/DEFAULT/ntp_conf >> >> ...but puppet thinks the variable is undefined: >> >> # cat /tmp/notify.pp >> notify{$hardwaremodel:} >> notify{$v_ntp__ntp_conf:}For completeness, I''ll add that I get the same result regardless of whether I refer to the custom fact as $v_ntp__ntp_conf or $::v_ntp__ntp_conf, regardless of whether I try to expand the custom fact in a string or use it in a conditional test. Based on the lack of response, it looks like I should open a bug report? David>> [root@sazabi facts.d]# puppet apply /tmp/notify.pp >> Notice: x86_64 >> Notice: /Stage[main]//Notify[x86_64]/message: defined ''message'' as >> ''x86_64'' >> Notice: undef >> Notice: /Stage[main]//Notify[undef]/message: defined ''message'' as ''undef'' >> Notice: Finished catalog run in 0.28 seconds >> >> What am I missing here? Thanks! >> >> -- >> 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 >> <mailto:puppet-users+unsubscribe@googlegroups.com>. >> To post to this group, send email to puppet-users@googlegroups.com >> <mailto: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.-- David Thompson Waisman Center Brain Imaging and Behavior Lab 1500 Highland Ave. Room T133 Madison, WI 53705-2280 (608) 265-6608 dthompson (at) waisman (dot) wisc (dot) edu -- 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.
On Wednesday, September 11, 2013 8:07:59 AM UTC-5, David Thompson wrote:> > On 9/10/13 5:49 PM, Denmat wrote: > > > On 11/09/2013, at 1:38, David Thompson <dtho...@waisman.wisc.edu<javascript:> > > <mailto:dtho...@waisman.wisc.edu <javascript:>>> wrote: > > > >> I''m working with custom facts with facter 1.7.2. I''ve created a fact > >> file with an ntp configuration fact in it: > >> > >> # grep ntp_conf /etc/facter/facts.d/myfacts.txt > >> puppet:///modules/ntp/DEFAULT/ntp_conf > >> > >> facter knows the fact is there: > >> > >> # facter -p v_ntp__ntp_conf > >> puppet:///modules/ntp/DEFAULT/ntp_conf > >> > >> ...but puppet thinks the variable is undefined: > >> > >> # cat /tmp/notify.pp > >> notify{$hardwaremodel:} > >> notify{$v_ntp__ntp_conf:} > > For completeness, I''ll add that I get the same result regardless of > whether I refer to the custom fact as $v_ntp__ntp_conf or > $::v_ntp__ntp_conf, regardless of whether I try to expand the custom > fact in a string or use it in a conditional test. > > Based on the lack of response, it looks like I should open a bug report? > >Lack of response? This is a volunteer community forum, not a paid technical support service. Give it some time. Before you open a bug report, you should make sure that the file containing your custom fact(s) is readable by the Puppet agent service. That facter can read the file when you run it from the command line does not prove that. Even though the agent runs as a privileged user (or should), access could still be blocked in various ways, such as 1. Mandatory access controls (a.k.a. SELinux in enforcing mode) could allow you to read the file, but prevent the agent service from doing so. 2. If /etc/facter/facts.d is on an NFS-mounted filesystem that performs root-squashing, then the agent may have less permissions on it than you, personally, do. There are probably other means. Also, make sure Puppet is using the same Facter that you are using from the command line. If you have multiple versions installed then all manner of havoc might ensue. You might get multiple versions by installing them from gem or from source into different Ruby libraries, or into different parts of the same Ruby lib. 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. For more options, visit https://groups.google.com/groups/opt_out.
David Thompson
2013-Sep-11 15:12 UTC
Re: [Puppet Users] Custom Fact undefined in manifests
On 9/11/13 8:54 AM, jcbollinger wrote:> Lack of response? This is a volunteer community forum, not a paid > technical support service. Give it some time.No offense intended. I''m continually impressed by the effort made by the volunteers who watch this lists and provide so much help.> Before you open a bug report, you should make sure that the file > containing your custom fact(s) is readable by the Puppet agent service. > That facter can read the file when you run it from the command line does > not prove that. Even though the agent runs as a privileged user (or > should), access could still be blocked in various ways, such as > > 1. Mandatory access controls (a.k.a. SELinux in enforcing mode) could > allow you to read the file, but prevent the agent service from doing so. > 2. If /etc/facter/facts.d is on an NFS-mounted filesystem that performs > root-squashing, then the agent may have less permissions on it than > you, personally, do. > > There are probably other means. > > Also, make sure Puppet is using the same Facter that you are using from > the command line. If you have multiple versions installed then all > manner of havoc might ensue. You might get multiple versions by > installing them from gem or from source into different Ruby libraries, > or into different parts of the same Ruby lib.All good ideas. An strace of "puppet agent --test" (and/or the test manifest above) shows that puppet is able to read the fact file (and, yes, it''s on the local disk), and the the version of facter being loaded is the correct (and only) one (in my case, the RPM version 1.7.2, from /usr/lib/ruby/site_ruby/1.8/facter.rb and friends), and still show the custom facts as undef. Even if I reduce my custom facts to a single file containing a single trivial line ("somefact=somevalue"), the custom fact shows up in facter but not in puppet. I also get the same result when I pass the fact as yaml. I tried json, but got an error about missing the json gem, even though I have the puppetlabsdep rubygem-json RPM installed. -- David Thompson Waisman Center Brain Imaging and Behavior Lab 1500 Highland Ave. Room T133 Madison, WI 53705-2280 (608) 265-6608 dthompson (at) waisman (dot) wisc (dot) edu -- 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.
Hi, Do you have stdlib module installed? http://puppetlabs.com/blog/module-of-the-week-puppetlabsstdlib-puppetlabs-standard-library-part-3 On 12/09/2013, at 1:12, David Thompson <dthompson@waisman.wisc.edu> wrote:> On 9/11/13 8:54 AM, jcbollinger wrote: > >> Lack of response? This is a volunteer community forum, not a paid >> technical support service. Give it some time. > > No offense intended. I''m continually impressed by the effort made by the volunteers who watch this lists and provide so much help. > >> Before you open a bug report, you should make sure that the file >> containing your custom fact(s) is readable by the Puppet agent service. >> That facter can read the file when you run it from the command line does >> not prove that. Even though the agent runs as a privileged user (or >> should), access could still be blocked in various ways, such as >> >> 1. Mandatory access controls (a.k.a. SELinux in enforcing mode) could >> allow you to read the file, but prevent the agent service from doing so. >> 2. If /etc/facter/facts.d is on an NFS-mounted filesystem that performs >> root-squashing, then the agent may have less permissions on it than >> you, personally, do. >> >> There are probably other means. >> >> Also, make sure Puppet is using the same Facter that you are using from >> the command line. If you have multiple versions installed then all >> manner of havoc might ensue. You might get multiple versions by >> installing them from gem or from source into different Ruby libraries, >> or into different parts of the same Ruby lib. > > All good ideas. An strace of "puppet agent --test" (and/or the test manifest above) shows that puppet is able to read the fact file (and, yes, it''s on the local disk), and the the version of facter being loaded is the correct (and only) one (in my case, the RPM version 1.7.2, from /usr/lib/ruby/site_ruby/1.8/facter.rb and friends), and still show the custom facts as undef. > > Even if I reduce my custom facts to a single file containing a single trivial line ("somefact=somevalue"), the custom fact shows up in facter but not in puppet. > > I also get the same result when I pass the fact as yaml. I tried json, but got an error about missing the json gem, even though I have the puppetlabsdep rubygem-json RPM installed. > > -- > David Thompson > Waisman Center Brain Imaging and Behavior Lab > 1500 Highland Ave. Room T133 > Madison, WI 53705-2280 > (608) 265-6608 > dthompson (at) waisman (dot) wisc (dot) edu > > -- > 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.
David Thompson
2013-Sep-12 13:26 UTC
Re: [Puppet Users] Custom Fact undefined in manifests
On 9/11/13 4:28 PM, Denmat wrote:> Hi, > > Do you have stdlib module installed? > > http://puppetlabs.com/blog/module-of-the-week-puppetlabsstdlib-puppetlabs-standard-library-part-3No. I don''t see stdlib listed as a requirement to using custom/external facts in the puppet docs: http://docs.puppetlabs.com/guides/custom_facts.html Is there a reason you think stdlib will fix this? David> On 12/09/2013, at 1:12, David Thompson <dthompson@waisman.wisc.edu > <mailto:dthompson@waisman.wisc.edu>> wrote: > >> On 9/11/13 8:54 AM, jcbollinger wrote: >> >>> Lack of response? This is a volunteer community forum, not a paid >>> technical support service. Give it some time. >> >> No offense intended. I''m continually impressed by the effort made by >> the volunteers who watch this lists and provide so much help. >> >>> Before you open a bug report, you should make sure that the file >>> containing your custom fact(s) is readable by the Puppet agent service. >>> That facter can read the file when you run it from the command line does >>> not prove that. Even though the agent runs as a privileged user (or >>> should), access could still be blocked in various ways, such as >>> >>> 1. Mandatory access controls (a.k.a. SELinux in enforcing mode) could >>> allow you to read the file, but prevent the agent service from >>> doing so. >>> 2. If /etc/facter/facts.d is on an NFS-mounted filesystem that performs >>> root-squashing, then the agent may have less permissions on it than >>> you, personally, do. >>> >>> There are probably other means. >>> >>> Also, make sure Puppet is using the same Facter that you are using from >>> the command line. If you have multiple versions installed then all >>> manner of havoc might ensue. You might get multiple versions by >>> installing them from gem or from source into different Ruby libraries, >>> or into different parts of the same Ruby lib. >> >> All good ideas. An strace of "puppet agent --test" (and/or the test >> manifest above) shows that puppet is able to read the fact file (and, >> yes, it''s on the local disk), and the the version of facter being >> loaded is the correct (and only) one (in my case, the RPM version >> 1.7.2, from /usr/lib/ruby/site_ruby/1.8/facter.rb and friends), and >> still show the custom facts as undef. >> >> Even if I reduce my custom facts to a single file containing a single >> trivial line ("somefact=somevalue"), the custom fact shows up in >> facter but not in puppet. >> >> I also get the same result when I pass the fact as yaml. I tried >> json, but got an error about missing the json gem, even though I have >> the puppetlabsdep rubygem-json RPM installed. >> >> -- >> David Thompson >> Waisman Center Brain Imaging and Behavior Lab >> 1500 Highland Ave. Room T133 >> Madison, WI 53705-2280 >> (608) 265-6608 >> dthompson (at) waisman (dot) wisc (dot) edu >> >> -- >> 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 >> <mailto:puppet-users+unsubscribe@googlegroups.com>. >> To post to this group, send email to puppet-users@googlegroups.com >> <mailto: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.-- David Thompson Waisman Center Brain Imaging and Behavior Lab 1500 Highland Ave. Room T133 Madison, WI 53705-2280 (608) 265-6608 dthompson (at) waisman (dot) wisc (dot) edu -- 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.