I have a following puppet module
class base (
$someBoolean=false,
)
{
exec { 'Do something':
command => '/usr/bin/someStuff',
timeout => (someBoolean) ? 100000000 : 300
}
}
The timeout => () ? :
is enssentially what I want to do, but what is the correct syntax to do it? Is it possible at all?
Puppet's version of the ternary operator is the more general "selector". The syntax for your case looks like this:
exec { 'Do something':
command => '/usr/bin/someStuff',
timeout => $someBoolean ? { true => 100000000, default => 300 }
}
The control expression ($someBoolean
in the above) can in fact be any expression that produces a value, and any number of corresponding cases can be provided.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With