Exec{} keeps running

26 views
Skip to first unread message

Douglas Garstang

unread,
Aug 27, 2012, 6:39:30 PM8/27/12
to Puppet Users
Argh. I have the definition below. The gluster peer probe command has
already been executed successfully, and I'm testing it with 'peer
status'. Running the unless=> command yields:

root@gfs01:~# /usr/sbin/gluster peer status | /bin/grep gfs02.us1.xxx.com
Hostname: gfs02.us1.xxx.com
root@gfs01:~# echo $?
0

Therefore, the command should never run again, but it is, as evidenced
by the fact that /tmp/foo keeps getting X appended to it.

define glusterfs::probe_peer ( $ensure, $master_node ) {

if $master_node == $::fqdn {
case $ensure {
'probed': {
exec {
"add-peer-$name":
#command => "/usr/sbin/gluster peer probe $name",
command => "/bin/echo X >> /tmp/foo",
logoutput => true,
unless => "/usr/sbin/gluster peer status |
/bin/grep $name";
}
}
}
}
}

Doug.

jcbollinger

unread,
Aug 28, 2012, 10:08:21 AM8/28/12
to puppet...@googlegroups.com

Usually this kind of problem arises when the command being run (the 'unless' command in this case) relies on an environment variable whose presence or value differs in an interactive shell from what the (very sparse) environment in which an Exec runs things.

In this case, I also don't have enough information to rule out the possibility that $name's value differs from the expected value of "gfs02.us1.xxx.com".


John

Douglas Garstang

unread,
Aug 28, 2012, 11:17:09 AM8/28/12
to puppet...@googlegroups.com
Thanks. This one turned out to be user error. :)
> --
> 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/-/aOuMVbKCDKIJ.
> 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.



--
Regards,

Douglas Garstang
http://www.linkedin.com/in/garstang
Email: doug.g...@gmail.com
Cell: +1-805-340-5627
Reply all
Reply to author
Forward
0 new messages