summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authormh <mh@immerda.ch>2011-10-27 23:38:41 +0200
committermh <mh@immerda.ch>2011-10-27 23:38:41 +0200
commit716267086b88c4825e6f82e7121b3bc03f636202 (patch)
tree0f3c98f8943523d1ae2f6c79af2d40946b406a75 /lib
parentabc6919245bca4c1965376fec4744df2329211a5 (diff)
parent64205c93a957bafdfb255a991844f2d7744f11b5 (diff)
merge
Diffstat (limited to 'lib')
-rw-r--r--lib/puppet/parser/functions/trocla.rb4
-rw-r--r--lib/puppet/util/trocla_helper.rb7
2 files changed, 10 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 374d538..58ccf9c 100644
--- a/lib/puppet/util/trocla_helper.rb
+++ b/lib/puppet/util/trocla_helper.rb
@@ -17,7 +17,12 @@ module Puppet::Util::TroclaHelper
format = args[1] || 'plain'
options = args[2] || {}
- configfile = File.join(File.dirname(Puppet.settings[:config]), 'troclarc.yaml')
+ 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} is not readable") unless File.exist?(configfile)
raise(Puppet::ParseError, "You need rubygems to use Trocla") unless Puppet.features.rubygems?