class testingclass(
$cmd_path = 'PluginDir',
){
$message_ntfy = "cmd_path is set to: ${cmd_path} for ${name}"
notify { $message_ntfy: }
}
define testingdefine(
$cmd_path = 'PluginDir',
){
$message_ntfy = "cmd_path is set to: ${cmd_path} for ${name}"
notify { $message_ntfy: }
}
node default {
class {'testingclass':
cmd_path => undef,
}
testingdefine { 'testingdefinedefaults': }
testingdefine { 'testingdefineundef':
cmd_path => undef,
}
}
erik.anderson@puppetmaster1:~$ sudo puppet apply test.pp
Warning: Config file /etc/puppetlabs/code/hiera.yaml not found, using Hiera defaults
Notice: Compiled catalog for sa-sand-puppetmaster1.sa.moneydesktop.com in environment production in 0.15 seconds
Notice: cmd_path is set to: PluginDir for testingclass
Notice: /Stage[main]/Testingclass/Notify[cmd_path is set to: PluginDir for testingclass]/message: defined 'message' as 'cmd_path is set to: PluginDir for testingclass'
Notice: cmd_path is set to: PluginDir for testingdefinedefaults
Notice: /Stage[main]/Main/Node[default]/Testingdefine[testingdefinedefaults]/Notify[cmd_path is set to: PluginDir for testingdefinedefaults]/message: defined 'message' as 'cmd_path is set to: PluginDir for testingdefinedefaults'
Notice: cmd_path is set to: PluginDir for testingdefineundef
Notice: /Stage[main]/Main/Node[default]/Testingdefine[testingdefineundef]/Notify[cmd_path is set to: PluginDir for testingdefineundef]/message: defined 'message' as 'cmd_path is set to: PluginDir for testingdefineundef'
Notice: Applied catalog in 0.35 seconds
--
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/26d1f9c0-61b6-47d3-a7fc-350fee0f2035%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
-----Original message-----
From: Rob Nelson <rnel...@gmail.com>
Sent: Tuesday 26th April 2016 17:15
To: puppet...@googlegroups.com
Subject: Re: [Puppet Users] Setting var to undef does not override class or define defaultsPassing undef to a parameter doesn't unset it. It's the same as not passing it. I do not believe there is a standard way to unset a parameter with a default value. You can set it to '', 0, false, or another appropriate "unset" value depending on how it is to be used, though.
When you want a way to be able to unset it,
you could use a second parameter, manage_<paramx> = boolean.
(as rob told me :) )
To view this discussion on the web visit https://groups.google.com/d/msgid/puppet-users/CAC76iT_dPzxLR_0AQ2veD9G3gy%3DxR4Ty9%2B_x4yMhZRTQ9tVqwQ%40mail.gmail.com.