Created
May 16, 2016 10:56
-
-
Save fatmcgav/e72d8f5bd8d3a5307d3225a15bccd096 to your computer and use it in GitHub Desktop.
Module_data_backend patch for scope issue
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/lib/hiera/backend/module_data_backend.rb b/lib/hiera/backend/module_data_backend.rb | |
index 8bed934..6987209 100644 | |
--- a/lib/hiera/backend/module_data_backend.rb | |
+++ b/lib/hiera/backend/module_data_backend.rb | |
@@ -61,22 +62,33 @@ class Hiera | |
found = false | |
Hiera.debug("Looking up %s in Module Data backend" % key) | |
+ Hiera.debug("Module = #{scope['module']}") | |
+ Hiera.debug("Module_name = #{scope["module_name"]}") | |
module_name = begin | |
- scope["module_name"] | |
+ scope['module'] | |
rescue Puppet::ParseError # Gets thrown if not in a module and strict_variables = true | |
end | |
+ Hiera.debug("First module_name = #{module_name.inspect}") | |
+ | |
+ if module_name.nil? | |
+ Hiera.debug('Module_name is empty, looking up module_name from scope') | |
+ module_name = scope['module_name'] | |
+ end | |
+ Hiera.debug("Second module_name = #{module_name.inspect}") | |
unless module_name | |
Hiera.debug("Skipping Module Data backend as this does not look like a module") | |
return no_answer | |
end | |
- config = load_module_config(scope["module_name"], scope["::environment"]) | |
+ config = load_module_config(module_name, scope["::environment"]) | |
unless config["path"] | |
Hiera.debug("Could not find a path to the module '%s' in environment '%s'" % [scope["module_name"], scope["::environment"]]) | |
return no_answer | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment