Description
This is an extension of an old Redmine issue that affected Puppet proper (#15791, to be specific), which affected fqdn_rand(). Specifically, the issue is that fqdn_rotate() changes the global seed and then doesn't reset it. This can be fixed by changing fqdn_rand() to either reset the global seed or use fqdn_rand()/Puppet::Util.deterministic_rand() for generating its random numbers. Puppet::Util.deterministic_rand() was added in Puppet 3.2.0 and either doesn't modify the global seed or (if that isn't possible) resets it after use, and fqdn_rand() was modified to use it for its random numbers.
To demonstrate this issue, you can add the following line to the end of fqdn_rotate.rb before it returns:
Puppet.warning("rand: #{rand}")
|
and execute fqdn_rotate() twice in a single run:
[root@puppet-eli ~]# puppet apply -e 'notice fqdn_rotate("abcdef") notice fqdn_rotate("abcdef")'
|
Warning: rand: 0.017745413299069535
|
Notice: Scope(Class[main]): efabcd
|
Warning: rand: 0.017745413299069535
|
Notice: Scope(Class[main]): efabcd
|
Notice: Compiled catalog for puppet-eli.localdomain in environment production in 0.03 seconds
|
Notice: Finished catalog run in 0.10 seconds
|
Ideally, the two warnings would have different values in them.
Attachments
Issue Links
- links to