summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRoman Barczyński <romke@estrefa.pl>2011-03-03 04:08:32 +0100
committerRoman Barczyński <romke@estrefa.pl>2011-03-03 04:08:32 +0100
commitab749e74149ee82cb903ed82dc8396657d1d5b83 (patch)
tree7f9216f0d8120f0dadc23cd298edc50a022f8090
parent5caaf18c109f0dfb0657889e12fc65c810955782 (diff)
downloadpuppet-stdlib-ab749e74149ee82cb903ed82dc8396657d1d5b83.tar.gz
puppet-stdlib-ab749e74149ee82cb903ed82dc8396657d1d5b83.tar.bz2
no need for "#! ruby", vim modeline must end with ":", and fixed not found key bug
-rw-r--r--load_vars.rb6
1 files changed, 2 insertions, 4 deletions
diff --git a/load_vars.rb b/load_vars.rb
index 0365cf9..07ee745 100644
--- a/load_vars.rb
+++ b/load_vars.rb
@@ -1,5 +1,3 @@
-#!/usr/bin/env ruby
-#
# load_vars.rb
#
# This script will allow for loading variables from an external YAML
@@ -59,11 +57,11 @@ module Puppet::Parser::Functions
raise(Puppet::ParseError,
"Data in the file `%s' is not a hash" % file) unless data.is_a?(Hash)
- data = data[key] if key and data[key].is_a?(Hash)
+ data = ((data[key].is_a?(Hash)) ? data[key] : {}) if key
end
data.each { |param, value| setvar(param, strinterp(value)) }
end
end
-# vim: set ts=2 sw=2 et
+# vim: set ts=2 sw=2 et :