smortex
07/26/2022, 6:31 PMsmortex
07/26/2022, 6:31 PMspin
07/26/2022, 6:32 PMsmortex
07/26/2022, 6:32 PMnatemccurdy
07/26/2022, 6:35 PMclass { 'foo':
some_param => undef,
}
Declaring a class and specifying a parameter’s value as undef
is effectively the same as not declaring that parameter.
The consequence of that is that the parameter’s value will then be looked up via APL, then fall back to the parameter’s default value (if one is defined).
So if a parameter has a default value of something, you can’t override that by passing in undef
at declaration time.
Is this the situation you’re in?natemccurdy
07/26/2022, 6:37 PMclass { 'foo':
some_param => undef,
}
Declaring a class and specifying a parameter’s value as undef
is effectively the same as not declaring that parameter.
The consequence of that is that the parameter’s value will then be looked up via APL, then fall back to the parameter’s default value (if one is defined).
So if a parameter has a default value of something, you can’t override that by passing in undef
at declaration time.
Is this the situation you’re in?spin
07/26/2022, 6:53 PMparameter 'package_url' expects a value of type Undef or String, got Type[Undef]
natemccurdy
07/26/2022, 6:56 PMUndef
or undef
?spin
07/26/2022, 7:41 PMpuppet apply --modulepath=. -e "class { 'test': param1 => Undef,}"
Error: Evaluation Error: Error while evaluating a Resource Statement, Class[Test]: parameter 'param1' expects a value of type Undef or String, got Type[Undef] (line: 1, column: 1) on node
natemccurdy
07/26/2022, 7:41 PMundef
, not Undef
.natemccurdy
07/26/2022, 7:43 PMOptional[String]
)vchepkov
07/26/2022, 7:43 PMtest
has default value set for param1 ? because it will be used when you are passing undef
, you can't pass undef to a classnatemccurdy
07/26/2022, 7:43 PMOptional[String]
)spin
07/26/2022, 7:43 PMvchepkov
07/26/2022, 7:44 PMnatemccurdy
07/26/2022, 7:44 PMundef
is the same as not passing the parameter at all, so its defaults will be used instead (APL -> param default).vchepkov
07/26/2022, 7:44 PMnatemccurdy
07/26/2022, 7:44 PMundef
is the same as not passing the parameter at all, so its defaults will be used instead (APL -> param default).spin
07/26/2022, 7:45 PMnatemccurdy
07/26/2022, 7:46 PMUndef
is a type. undef
is a value that is of type Undef
.natemccurdy
07/26/2022, 7:46 PMUndef
is a type. undef
is a value that is of type Undef
.spin
07/26/2022, 7:51 PMnatemccurdy
07/26/2022, 7:52 PMpick()
spin
07/26/2022, 7:53 PMnatemccurdy
07/26/2022, 7:53 PMget()
will return undef
as a default: https://puppet.com/docs/puppet/6/function.html#getspin
07/26/2022, 8:13 PMDr Bunsen Honeydew
07/26/2022, 9:45 PMEsteban Almarales
07/26/2022, 11:24 PMEsteban Almarales
07/26/2022, 11:24 PMnatemccurdy
07/26/2022, 11:34 PMsource
attribute.
source => '//some/path/on/a/network/share/installer.msi',