summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorasq <asq@asq.art.pl>2014-04-03 19:02:02 +0200
committerAnna Janackova <anna.janackova@gmail.com>2014-06-24 08:11:45 +0200
commit9f21b44da1ec9b24820ac08e2e4d1e171fabbf7e (patch)
tree125268cae73eb23fc109b8e11a143dc6cae7d7ed
parentb70fcc845696f58b2a5d36039df5f2c8c1dd2e04 (diff)
puppet will convert all values to string, so we need to convert it back to integer for ranges
ie. for this to work: $short_and_safe = { 'shellsafe' => 'true', 'length' => 6, # THIS WILL BE STRING! } $x = trocla('foo', 'plain', $short_and_safe) notify { "test: $x": }
-rw-r--r--lib/trocla.rb2
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/trocla.rb b/lib/trocla.rb
index 7755149..74825aa 100644
--- a/lib/trocla.rb
+++ b/lib/trocla.rb
@@ -22,7 +22,7 @@ class Trocla
plain_pwd = get_password(key,'plain')
if options['random'] && plain_pwd.nil?
- plain_pwd = Trocla::Util.random_str(options['length'],options['shellsafe'])
+ plain_pwd = Trocla::Util.random_str(options['length'].to_i,options['shellsafe'])
set_password(key,'plain',plain_pwd) unless format == 'plain'
elsif !options['random'] && plain_pwd.nil?
raise "Password must be present as plaintext if you don't want a random password"