Ask Your Question

Evaluating variables inside onlyif close

asked 2016-06-28 05:10:21 -0600

itaremyinitials gravatar image

updated 2016-06-28 16:54:57 -0600

lupin gravatar image

Hi, I have a variable that i set at a very early stage, the variable is boolean, then at some point i want to exec a command based on the fact if this variable is true or false, something like this :

exec  { 'update-to-latest-core':     
  command        => "do something",
  user           => 'root', 
  refreshonly    => true,
  path           => [ "/bin/bash", "sbin/" , "/usr/bin/", "/usr/sbin/" ], 
  onlyif         =>  ['test ${latest} = true'],
  notify         => Exec["update-to-latest-database"],

So this command doesn't work (onlyif => ['test ${latest} = true'],) I tried several other ways too , but didn't work . Something so simple cannot be so hard to do , Can someone help me with this , and also explain the rules behind getting commands to execute inside onlyif close. (also i cannot use if-close on a higher level because I have other dependencies )

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2016-06-28 20:50:36 -0600

This was answered at Stack Overflow.

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower


Asked: 2016-06-28 05:09:48 -0600

Seen: 100 times

Last updated: Jun 28 '16