-----Original message----- From: Rob Nelson <[email protected]> Sent: Tuesday 26th April 2016 17:15 To: [email protected] Subject: Re: [Puppet Users] Setting var to undef does not override class or define defaults
Passing 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 :) ) Rob Nelson [email protected] <mailto:[email protected]> On Sat, Apr 23, 2016 at 3:46 PM, Erik Anderson <[email protected] <mailto:[email protected]> > wrote: On Puppet 4.4.1 I ran the following: 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, } } I expect cmd_path to be set to undef for the class and testingdefineundef. Instead it looks like all three end up with the same value for cmd_path: 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 Any ideas on why it is behaving this way and is it intentional? -- 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 [email protected] <mailto:[email protected]> . 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. -- 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 [email protected] <mailto:[email protected]> . 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. For more options, visit https://groups.google.com/d/optout. -- 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 [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/puppet-users/zarafa.57208e78.0dd9.7ff88b1105553edf%40zarafa.open-future.be. For more options, visit https://groups.google.com/d/optout.
