[Puppet Users] using return value of a shell command as a puppet conditional

Ashley Gould
Mon, 31 Jan 2011 21:12:50 -0000

Hi all,

My first post.  I am just getting started with puppet and have made
good progress with some basics using templates and files.

I would like to perform and an action based on whether or not a
particular system binary executes successfully, but I don''t see an
obvious way to set puppet conditionals based on an exit value of an
arbitrary command.  Is there a well known recipe that does something
like this shell snippet?:

if [ "/usr/bin/my_harmless_binary 2>&1 >/dev/null" ]; then
  echo "my_harmless_binary succeeded"
  cp /tmp/file1 /data/
else
  echo "my_harmless_binary FAILED"
fi



--

-ashley

Did you try poking at it with a stick?