From c5293e630c8c764c66721cbae5fa828b4f213f8b Mon Sep 17 00:00:00 2001 From: Krzysztof Wilczynski Date: Thu, 3 Mar 2011 09:18:12 +0000 Subject: Fix. Should yield empty data structure when given key cannot be found in the hash upon parsing YAML file. --- load_vars.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/load_vars.rb b/load_vars.rb index bebe4d8..b39df27 100644 --- a/load_vars.rb +++ b/load_vars.rb @@ -58,7 +58,7 @@ 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 = (key and data[key].is_a?(Hash) ? data[key] : {}) end data.each { |param, value| setvar(param, strinterp(value)) } -- cgit v1.2.3