Re: [Puppet Users] Using onlyif

293 views
Skip to first unread message

Ryan Coleman

unread,
Jul 3, 2012, 12:14:25 AM7/3/12
to puppet...@googlegroups.com
Binaries like curl and test must be fully qualified (ex. /bin/rm) or you must pass the path attribute to your exec resource with a search path like '/bin:/usr/bin' as the value. 

HTH, --Ryan

On Monday, July 2, 2012, Benjamin Lei wrote:
Here's what I'm using:
exec { "cert-fix":
command => "curl http://curl.haxx.se/ca/cacert.pem -o /etc/pki/tls/certs/ca-bundle.crt",
onlyif => "test -e /etc/pki/tls/certs/ca-bundle.crt",
}

But it keeps on failing:
[default] Running Puppet with /tmp/vagrant-puppet/manifests/acid.pp...
Parameter onlyif failed: 'test -e /etc/pki/tls/certs/ca-bundle.crt' is both unqu
alifed and specified no search path at /tmp/vagrant-puppet/manifests/acid.pp:23

The following SSH command responded with a non-zero exit status.
Vagrant assumes that this means the command failed!

I am trying to make that exec run the command if the file for it does not exist yet.
What am I doing wrong? 

--
You received this message because you are subscribed to the Google Groups "Puppet Users" group.
To view this discussion on the web visit https://groups.google.com/d/msg/puppet-users/-/5XjljtHXxCAJ.
To post to this group, send email to puppet...@googlegroups.com.
To unsubscribe from this group, send email to puppet-users...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.


--
Ryan Coleman | about.me/ryc
Modules & Forge @ Puppet Labs

Benjamin Lei

unread,
Jul 3, 2012, 12:54:21 AM7/3/12
to puppet...@googlegroups.com
So fully qualified means I need to add in a path to the command I'm trying to execute (i.e. test/grep)?


On Monday, July 2, 2012 9:14:25 PM UTC-7, Ryan Coleman wrote:
Binaries like curl and test must be fully qualified (ex. /bin/rm) or you must pass the path attribute to your exec resource with a search path like '/bin:/usr/bin' as the value. 

HTH, --Ryan

On Monday, July 2, 2012, Benjamin Lei wrote:
Here's what I'm using:
exec { "cert-fix":
command => "curl http://curl.haxx.se/ca/cacert.pem -o /etc/pki/tls/certs/ca-bundle.crt",
onlyif => "test -e /etc/pki/tls/certs/ca-bundle.crt",
}

But it keeps on failing:
[default] Running Puppet with /tmp/vagrant-puppet/manifests/acid.pp...
Parameter onlyif failed: 'test -e /etc/pki/tls/certs/ca-bundle.crt' is both unqu
alifed and specified no search path at /tmp/vagrant-puppet/manifests/acid.pp:23

The following SSH command responded with a non-zero exit status.
Vagrant assumes that this means the command failed!

I am trying to make that exec run the command if the file for it does not exist yet.
What am I doing wrong? 

--
You received this message because you are subscribed to the Google Groups "Puppet Users" group.
To view this discussion on the web visit https://groups.google.com/d/msg/puppet-users/-/5XjljtHXxCAJ.
To post to this group, send email to puppet...@googlegroups.com.
To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com.

For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.

Ryan Coleman

unread,
Jul 3, 2012, 12:55:32 AM7/3/12
to puppet...@googlegroups.com


On Monday, July 2, 2012, Benjamin Lei wrote:
So fully qualified means I need to add in a path to the command I'm trying to execute (i.e. test/grep)?

Yep. The command should execute at that point. :-) 
To view this discussion on the web visit https://groups.google.com/d/msg/puppet-users/-/ocGCHl0Q5VsJ.

To post to this group, send email to puppet...@googlegroups.com.
To unsubscribe from this group, send email to puppet-users...@googlegroups.com.

For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.

jcbollinger

unread,
Jul 3, 2012, 9:15:10 AM7/3/12
to puppet...@googlegroups.com


On Monday, July 2, 2012 11:14:25 PM UTC-5, Ryan Coleman wrote:
Binaries like curl and test must be fully qualified (ex. /bin/rm) or you must pass the path attribute to your exec resource with a search path like '/bin:/usr/bin' as the value. 


Or you can set a path via Exec's 'path' parameter.  Sometimes that's more convenient and / or clearer.


John

Felix Frank

unread,
Jul 5, 2012, 4:18:15 AM7/5/12
to puppet...@googlegroups.com
It's also safer. Some badly written scripts won't work unless invoked
with a valid PATH environment variable.

Cheers,
Felix

ad

unread,
Jul 5, 2012, 10:21:26 AM7/5/12
to Puppet Users
fwiw, I put this at the top of my global site.pp (one of 3 lines in
the file).

# Globally set exec path so we don't have to specify it each time we
use exec.
Exec { path => [ '/bin/', '/sbin/' , '/usr/bin/', '/usr/sbin/' ] }

hth,

Adam
Reply all
Reply to author
Forward
0 new messages