jms1
11/19/2025, 10:45 PMpdk validate returns this error
pdk (WARNING): puppet-lint: class parameter with String type defaults to empty string
on this line in a class's parameter list
String $xyz = '' ,
... removing the = '' makes puppet-lint happy, but it changes the parameter from "optional with a default value" (which is what i need in this case) to "required" (which is NOT what i need)jms1
11/19/2025, 10:45 PMbastelfreak
11/19/2025, 10:52 PMbastelfreak
11/19/2025, 10:53 PMjms1
11/19/2025, 10:57 PMjms1
11/19/2025, 10:58 PMjms1
11/19/2025, 11:00 PM.sync.yml file:
Rakefile :
extra_disabled_lint_checks :
- 'params_empty_string_assignment'
then run pdk updatekenyon
11/20/2025, 1:24 AMundef resolves to empty string, so I don't see any reason to default to empty string. for junior teammates, it's better to follow the practices that the rest of the puppet world (i.e., Vox Pupuli) usesYury Bushmelev
11/20/2025, 3:59 AMOptional[String[1]] $xyz = undef` makes more sense.csharpsteen
11/20/2025, 4:22 PMundef instead of '' allows you to enforce that the string should have at least one character in it. That makes it easier to distinguish between "default value" and "something messed up".
Often, a query or data source that mis-fires will return an empty string. For example, a shell script that doesn't produce anything will result in a stdout of '' and using Optional[String[1]] allows you to trap that as an error case.jms1
11/20/2025, 5:09 PMpuppet-lint test which is enabled by default?csharpsteen
11/20/2025, 5:13 PM