diff options
Diffstat (limited to 'lib/puppet')
-rw-r--r-- | lib/puppet/parser/functions/trocla.rb | 4 | ||||
-rw-r--r-- | lib/puppet/util/trocla_helper.rb | 6 |
2 files changed, 9 insertions, 1 deletions
diff --git a/lib/puppet/parser/functions/trocla.rb b/lib/puppet/parser/functions/trocla.rb index 487d1fd..e042872 100644 --- a/lib/puppet/parser/functions/trocla.rb +++ b/lib/puppet/parser/functions/trocla.rb @@ -20,6 +20,10 @@ Create or get the mysql style sha1 hashed password. # this needs to be assigned # like that. $password_user3 = trocla('user3','pgsql', $options_user3) + +Options can also be passed as a yaml string: + + $password_user3 = trocla('user3','pgsql', \"username: 'user3'\") " ) do |*args| require File.dirname(__FILE__) + '/../../util/trocla_helper' diff --git a/lib/puppet/util/trocla_helper.rb b/lib/puppet/util/trocla_helper.rb index ea4edee..9a41c0e 100644 --- a/lib/puppet/util/trocla_helper.rb +++ b/lib/puppet/util/trocla_helper.rb @@ -16,7 +16,11 @@ module Puppet::Util::TroclaHelper key = args[0] || raise(Puppet::ParseError, "You need to pass at least a key as an argument!") format = args[1] || 'plain' options = args[2] || {} - + if options.is_a?(String) + require 'yaml' + options = YAML.load(options) + end + configfile = File.join(File.dirname(Puppet.settings[:config]), "troclarc.yaml") raise(Puppet::ParseError, "Trocla config file #{configfile} not readable") unless File.exist?(configfile) |