diff options
author | mh <mh@immerda.ch> | 2011-09-06 15:02:51 +0200 |
---|---|---|
committer | mh <mh@immerda.ch> | 2011-09-06 15:02:51 +0200 |
commit | 64205c93a957bafdfb255a991844f2d7744f11b5 (patch) | |
tree | 4b53b63ad9bd9d2785fe27190fccecee54ef90da /lib/puppet/util/trocla_helper.rb | |
parent | 0b59b4e84c8d3d2244294e625f0b916709959e28 (diff) |
as setting a hash first is a bit cumbersome, we provide the possibility to pass a yaml string
Diffstat (limited to 'lib/puppet/util/trocla_helper.rb')
-rw-r--r-- | lib/puppet/util/trocla_helper.rb | 6 |
1 files changed, 5 insertions, 1 deletions
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) |