Allow assignments to be conditional too
skx opened this issue · comments
Steve Kemp commented
Putting together some decent examples, in #66, made me consider how other people might approach problems.
I tend to use wget
for downloading binaries, for example. But these days curl
is perhaps more common.
It might be nice to support this:
let download=""
let download="/usr/bin/curl" if exists(/usr/bin/curl)
let download="/usr/bin/wget" if exists(/usr/bin/wget)
fail { message => "Can't find download program", if empty(download)}
Of course there's the obvious argument "If you want to use wget just .. install it":
package { name => "wget", state => "installed", name => "wget:package" }
shell { name => "download" , require => "wget:package" }
Still supporting conditionals in rules and includes does mean that assignments are the odd one out ..