if $creates != nil {exec { "drush-${title}" :command => "drush ${command} ${root_option} ${uri_option} ${force_option} ${additional_options}",path => [ '/bin', '/usr/bin' ],creates => $creates,}} else {exec { "drush-${title}" :command => "drush ${command} ${root_option} ${uri_option} ${force_option} ${additional_options}",path => [ '/bin', '/usr/bin' ],}}
I have not tried with the creates param, but if its undef ( I.e. no one have set it) you can use it directly
exec { "drush-${title}" :
command => "drush ${command} ${root_option} ${uri_option} ${force_option} ${additional_options}",
path => [ '/bin', '/usr/bin' ],
creates => $creates,
}
If it's undef, this should work like not specifying it.
Regards,
--
You received this message because you are subscribed to the Google Groups "Puppet Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to puppet-users...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/puppet-users/753daff9-b848-40b9-bca8-1328c313c870%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Have you tried to set it to undef?
To view this discussion on the web visit https://groups.google.com/d/msgid/puppet-users/dcb1d2de-5e97-4650-9c30-50525eae9b6e%40googlegroups.com.
define drush::exec($command = $title,$creates = undef,)
I'm probably going about this all wrong, but I have an instance where I've employed a Puppet module and need to sometimes add a "creates" attribute to one of the exec's defined there. My code (below) is probably all wrong, but I think you'll see what I am trying to do...if $creates != nil {
exec { "drush-${title}" :command => "drush ${command} ${root_option} ${uri_option} ${force_option} ${additional_options}",path => [ '/bin', '/usr/bin' ],creates => $creates,}} else {exec { "drush-${title}" :command => "drush ${command} ${root_option} ${uri_option} ${force_option} ${additional_options}",path => [ '/bin', '/usr/bin' ],}}This doesn't work and neither does specifying an empty or nil attribute, like "creates => ''" or "creates => nil".
On 2014-29-05 19:59, jcbollinger wrote:
>
> You want
>
> creates => undef
>
> for that approach (no quotes). That's an affirmative declaration of not
> specifying any value, even an empty one, for the given parameter.
>
To be pedantic, it means "use the default value".
You do not need the conditional construct around the resource, simply
use
creates => $creates
Since, if $creates is undefined, so will creates parameter be.
(at least in theory, but may depend on the impl of the exec resource type).