summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormh <mh@immerda.ch>2015-08-12 08:42:35 +0200
committermh <mh@immerda.ch>2015-08-12 08:42:35 +0200
commit0e320508328db93fc2ca8aa29eb1ed22e0f0f22a (patch)
tree75571eef2654a8ca725624b94221548cfa610922
parentae723cfc50707b79891bc2eac99d10d5b044d53e (diff)
whitespace cleanup
-rw-r--r--lib/puppet/parser/functions/trocla_set.rb10
-rw-r--r--lib/puppet/util/trocla_helper.rb4
2 files changed, 7 insertions, 7 deletions
diff --git a/lib/puppet/parser/functions/trocla_set.rb b/lib/puppet/parser/functions/trocla_set.rb
index c3c9b49..06da5ae 100644
--- a/lib/puppet/parser/functions/trocla_set.rb
+++ b/lib/puppet/parser/functions/trocla_set.rb
@@ -38,21 +38,21 @@ trocla, for example via cli.
if args[0].is_a?(Array)
args = args[0]
end
-
+
key = args[0]
value = args[1]
raise(Puppet::ParseError, "You need to pass at least key & value as an argument!") if key.nil? || value.nil?
-
+
format = args[2] || 'plain'
return_format = args[3] || format
options = args[4] || {}
-
+
configfile = File.join(File.dirname(Puppet.settings[:config]), "troclarc.yaml")
-
+
raise(Puppet::ParseError, "Trocla config file #{configfile} not readable") unless File.exist?(configfile)
require 'trocla'
-
+
result = (trocla=Trocla.new(configfile)).set_password(key,format,value)
if format != return_format && (result = trocla.get_password(key,return_format)).nil?
raise(Puppet::ParseError, "Plaintext password is not present, but required to return password in format #{return_format}") if (return_format == 'plain') || trocla.get_password(key,'plain').nil?
diff --git a/lib/puppet/util/trocla_helper.rb b/lib/puppet/util/trocla_helper.rb
index 64ef859..94670ae 100644
--- a/lib/puppet/util/trocla_helper.rb
+++ b/lib/puppet/util/trocla_helper.rb
@@ -16,7 +16,7 @@ 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)
@@ -27,7 +27,7 @@ module Puppet::Util::TroclaHelper
raise(Puppet::ParseError, "Trocla config file #{configfile} is not readable") unless File.exist?(configfile)
require 'trocla'
-
+
has_options ? Trocla.new(configfile).send(trocla_func, key, format, options) : Trocla.new(configfile).send(trocla_func, key, format)
end
module_function :trocla