On Wednesday, June 4, 2014 10:33:55 AM UTC-5, Supriya Uppalapati wrote: > > Hi, > > I am trying to run shell script through non root user in puppet facts. > > Here is my code. > > > * $cat cis_rhel6_check.rbrequire 'facter'* > > > > > > *Facter.add("cis_rhel6_check") do setcode do %x[ sh > /tmp/cis_rhel6_check.sh ] endend* > the shell script is in > > *drwxrwxrwt. 178 root root tmp* > > *ls -ls /tmp/cis_rhel6_check.sh44 -rwxrwxrwx 1 root pe-puppet 43916 May 19 > 15:28 /tmp/cis_rhel6_check.sh* > >
This -----^^^^ seems to be contradicted by > > *The issue was:* > *sh: /tmp/cis_rhel6_check.sh: No such file or directory* > > this ----^^^^. Can you, as that same non-root user, successfully execute the script both immediately before and immediately after eliciting that message from Facter (all on the same machine)? Note in particular that the Puppet agent syncs custom facts and evaluates them (along with all the other facts) before requesting a catalog, so you cannot rely on the agent to put the script in place for you where the fact expects it to be before the fact is evaluated. If it's a simple, 1st-party script then it might be a good approach to just rewrite it in Ruby in the fact body. Alternatively, you could also consider turning it into an external fact <http://docs.puppetlabs.com/guides/custom_facts.html#external-facts>. 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+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/puppet-users/b18bf7db-ccae-4687-9244-7d695ad5501e%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.