From cc2b09eb2a24f71d5ec29860f182588b32a254a6 Mon Sep 17 00:00:00 2001 From: asq Date: Thu, 3 Apr 2014 19:02:02 +0200 Subject: 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": } --- lib/trocla.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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" -- cgit v1.2.3