]> gitweb.fluxo.info Git - puppet-stdlib.git/commitdiff
no need for "#! ruby", vim modeline must end with ":", and fixed not found key bug
authorRoman Barczyński <romke@estrefa.pl>
Thu, 3 Mar 2011 03:08:32 +0000 (04:08 +0100)
committerRoman Barczyński <romke@estrefa.pl>
Thu, 3 Mar 2011 03:08:32 +0000 (04:08 +0100)
load_vars.rb

index 0365cf99048d7d544e78ec5bb47dcc411bd83574..07ee745e31a1f424e05ad7824891c3ae0bade098 100644 (file)
@@ -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 :