Issue #8814 has been updated by Nan Liu.
Status changed from Unreviewed to Accepted
Target version set to 2.7.x
Keywords set to Ruby 1.9.2
Confirmed Ruby 1.9.2 does not handle rand with string, and the patch seems
sensible:
ruby-1.9.2-p136 :002 > rand(4)
=> 1
ruby-1.9.2-p136 :003 > rand('4')
TypeError: can't convert String into Integer
from (irb):3:in `rand'
from (irb):3
from /Users/nan/.rvm/rubies/ruby-1.9.2-p136/bin/irb:16:in `<main>'
ruby-1.9.2-p136 :004 > rand('4'.to_i)
=> 1
ruby-1.9.2-p136 :005 >
----------------------------------------
Bug #8814: fqdn_rand() causes can't convert String into Integer error
https://projects.puppetlabs.com/issues/8814
Author: Noah Diewald
Status: Accepted
Priority: Normal
Assignee:
Category:
Target version: 2.7.x
Affected Puppet version: 2.7.1
Keywords: Ruby 1.9.2
Branch:
This is occurring in version 2.7.1 and in the master branch. I'm running ruby
1.9.2p290 on Arch Linux.
The section of my manifest looks like this:
<pre>
$rand_hour = fqdn_rand(23,5445)
$rand_minute = fqdn_rand(59,954)
</pre>
>From puppetd, I get:
<pre>
err: Could not retrieve catalog from remote server: Error 400 on SERVER: can't
convert String into Integer at /etc/puppet/manifests/mymanifest.pp:4 on node
example.com
</pre>
>From puppetmasterd, I get:
<pre>
err: can't convert String into Integer at /etc/puppet/manifests/mymanifest.pp:4
on node example.com
</pre>
I tried a number of things, like using only one argument to fqdn_rand() but it
turns out my version of Ruby's rand function doesn't like string arguments and
that fqdn_rand's arguments are strings when they reach rand.
I've included a patch that got things working for me.
--
You have received this notification because you have either subscribed to it,
or are involved in it.
To change your notification preferences, please click here:
http://projects.puppetlabs.com/my/account
--
You received this message because you are subscribed to the Google Groups
"Puppet Bugs" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/puppet-bugs?hl=en.