Ask Your Question
-1

Evaluating variables inside onlyif close

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

itaremyinitials gravatar image

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

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
1

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

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

Stats

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

Seen: 26 times

Last updated: Jun 28 '16