Also, This project exists:
https://github.com/arildjensen/cis-puppet/ It's not perfect but is an interesting project and it would be great to get more help with it. Thanks, Spencer On Thu, Jun 5, 2014 at 6:47 AM, jcbollinger <[email protected]> wrote: > > > 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 [email protected]. > To view this discussion on the web visit > https://groups.google.com/d/msgid/puppet-users/b18bf7db-ccae-4687-9244-7d695ad5501e%40googlegroups.com > <https://groups.google.com/d/msgid/puppet-users/b18bf7db-ccae-4687-9244-7d695ad5501e%40googlegroups.com?utm_medium=email&utm_source=footer> > . > > For more options, visit https://groups.google.com/d/optout. > -- Spencer Krum (619)-980-7820 -- 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 [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/puppet-users/CADt6FWOmo34KH5%3D6oA0sM9dQoTMOZuydqfVAus-YE4uVVno7aQ%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.
