'stdlib::fqdn_rand_string' parameter 'charset' expects a String value, got Undef
silug opened this issue · comments
Describe the Bug
Passing undef
as the second argument to fqdn_rand_string
results in a compilation error. This worked (unintentionally or not) in previous versions of stdlib.
Expected Behavior
Function returns a random string (as it did in 8.x)
Steps to Reproduce
Steps to reproduce the behavior:
- Install stdlib 9.0.0
[root@40776c2909e5 /]# puppet module install puppetlabs-stdlib -v 9.0.0
Notice: Preparing to install into /etc/puppetlabs/code/environments/production/modules ...
Notice: Downloading from https://forgeapi.puppet.com ...
Notice: Installing -- do not interrupt ...
/etc/puppetlabs/code/environments/production/modules
└── puppetlabs-stdlib (v9.0.0)
- Call
fqnd_rand_string
withundef
as the second argument
[root@40776c2909e5 /]# puppet apply -e 'notify { fqdn_rand_string(10, undef, "custom seed"): }'
Warning: This function is deprecated, please use stdlib::fqdn_rand_string instead. at ["unknown", 1]:["unknown", 0]
(location: /etc/puppetlabs/code/environments/production/modules/stdlib/lib/puppet/functions/deprecation.rb:35:in `deprecation')
Error: Evaluation Error: Error while evaluating a Function Call, 'stdlib::fqdn_rand_string' parameter 'charset' expects a String value, got Undef (line: 1, column: 10) on node 40776c2909e5
Environment
- Version: 9.0.0
- Platform: Rocky Linux 8 (shown here for example, others verified via rspec)
Additional Context
This code worked as recently as stdlib 8.6.0.
[root@865c93eff098 /]# puppet module install puppetlabs-stdlib -v 8.6.0
Notice: Preparing to install into /etc/puppetlabs/code/environments/production/modules ...
Notice: Downloading from https://forgeapi.puppet.com ...
Notice: Installing -- do not interrupt ...
/etc/puppetlabs/code/environments/production/modules
└── puppetlabs-stdlib (v8.6.0)
[root@865c93eff098 /]# puppet apply -e 'notify { fqdn_rand_string(10, undef, "custom seed"): }'
Notice: Compiled catalog for 865c93eff098 in environment production in 0.02 seconds
Notice: OhaNI3TjnN
Notice: /Stage[main]/Main/Notify[OhaNI3TjnN]/message: defined 'message' as 'OhaNI3TjnN'
Notice: Applied catalog in 0.00 seconds
Thanks for raising this @silug. Looks like this is being addressed in #1367, lets see if we can get it moving along.
Sorry @jordanbreen28, I completely missed that PR. It looks like the fix was merged in 24a0f21.
Thanks!