summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorasq <asq@asq.art.pl>2014-04-03 19:02:02 +0200
committerasq <asq@asq.art.pl>2014-04-03 19:02:02 +0200
commitcc2b09eb2a24f71d5ec29860f182588b32a254a6 (patch)
treeeb3f3a95f38008c6e3467d6df46ba652bdd97c20
parent4b0cd484e68a806e60a32a6d611333d41ec845aa (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"