mark.allison@thebbgroup.org
2013-Mar-18 15:26 UTC
[Puppet Users] custom fact works in testing but fails during puppet run
Hi I have the following custom fact: require ''facter'' Facter.add("chat_remote_port", :timeout => 5) do setcode do Facter::Util::Resolution.exec(''/usr/bin/ssh -o StrictHostKeyChecking=no -i /vagrant/fabfile/deployment/keys/id_rsa user@example.com \''for port in 12321 12322 12323 12324 12325 12326; do netsta\ t -an | grep $port > /dev/null ; if [ $? -eq 1 ]; then echo $port; fi; done\'''') end end It works fine when invoked via the ''facter'' command but seems to cause a hang when run during ''puppet apply''. Adding ''timeout'' does not cause Facter to move on. Why would this fail during ''puppet apply'' but work ok with ''facter''? Thanks Mark -- 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.
llowder
2013-Mar-18 15:42 UTC
[Puppet Users] Re: custom fact works in testing but fails during puppet run
On Monday, March 18, 2013 10:26:05 AM UTC-5, mark.a...@thebbgroup.org wrote:> > Hi > > I have the following custom fact: > > require ''facter'' > Facter.add("chat_remote_port", :timeout => 5) do > setcode do > Facter::Util::Resolution.exec(''/usr/bin/ssh -o > StrictHostKeyChecking=no -i /vagrant/fabfile/deployment/keys/id_rsa > us...@example.com <javascript:> \''for port in 12321 12322 12323 12324 > 12325 12326; do netsta\ > t -an | grep $port > /dev/null ; if [ $? -eq 1 ]; then echo $port; fi; > done\'''') > end > end > > It works fine when invoked via the ''facter'' command but seems to cause a > hang when run during ''puppet apply''. Adding ''timeout'' does not cause Facter > to move on. > > Why would this fail during ''puppet apply'' but work ok with ''facter''? > >Are you running facter and puppet as the same user?> Thanks > Mark > >-- 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.
Mark Allison
2013-Mar-18 15:45 UTC
Re: [Puppet Users] Re: custom fact works in testing but fails during puppet run
On Mon, Mar 18, 2013 at 3:42 PM, llowder <llowderiv@gmail.com> wrote:> Are you running facter and puppet as the same user? >I believe so. In testing I run as user root. During ''puppet apply'' (via ''vagrant provision'') I believe facter is run as root. I checked this by changing my command to /bin/whoami. That returned ''root''. I''ve searched for ways of debugging facts by, say, seeing any output they produce but have not found anything yet. Thanks Mark> > >> Thanks >> Mark >> >> -- > You received this message because you are subscribed to a topic in the > Google Groups "Puppet Users" group. > To unsubscribe from this topic, visit > https://groups.google.com/d/topic/puppet-users/QwBIOUL8qxQ/unsubscribe?hl=en > . > To unsubscribe from this group and all its topics, 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. > > >-- 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.
Mark Allison
2013-Mar-18 16:28 UTC
Re: [Puppet Users] Re: custom fact works in testing but fails during puppet run
Solution found here: https://github.com/mitchellh/vagrant/issues/603#issuecomment-13791117 All I needed was to add ''-n'' to the ssh invocation and it works perfectly. On Mon, Mar 18, 2013 at 3:45 PM, Mark Allison <mark.allison@thebbgroup.org>wrote:> On Mon, Mar 18, 2013 at 3:42 PM, llowder <llowderiv@gmail.com> wrote: > >> Are you running facter and puppet as the same user? >> > > I believe so. In testing I run as user root. During ''puppet apply'' (via > ''vagrant provision'') I believe facter is run as root. I checked this by > changing my command to /bin/whoami. That returned ''root''. > > I''ve searched for ways of debugging facts by, say, seeing any output they > produce but have not found anything yet. > > Thanks > Mark > > >> >> >>> Thanks >>> Mark >>> >>> -- >> You received this message because you are subscribed to a topic in the >> Google Groups "Puppet Users" group. >> To unsubscribe from this topic, visit >> https://groups.google.com/d/topic/puppet-users/QwBIOUL8qxQ/unsubscribe?hl=en >> . >> To unsubscribe from this group and all its topics, 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. >> >> >> > >-- 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.