diff --git a/lib/hiera/backend/eyaml_backend.rb b/lib/hiera/backend/eyaml_backend.rb index 9b58ece8..3613be45 100644 --- a/lib/hiera/backend/eyaml_backend.rb +++ b/lib/hiera/backend/eyaml_backend.rb @@ -13,7 +13,7 @@ class Eyaml_backend attr_reader :extension def initialize(cache = nil) - Hiera.debug("Hiera eYAML backend starting") + debug("Hiera eYAML backend starting") @cache = cache || Filecache.new @extension = Config[:eyaml][:extension] || "eyaml" @@ -24,10 +24,10 @@ def lookup(key, scope, order_override, resolution_type) parse_options(scope) - Hiera.debug("Looking up #{key} in eYAML backend") + debug("Looking up #{key} in eYAML backend") Backend.datasources(scope, order_override) do |source| - Hiera.debug("Looking for data source #{source}") + debug("Looking for data source #{source}") eyaml_file = Backend.datafile(:eyaml, scope, source, extension) || next next unless File.exists?(eyaml_file) @@ -43,7 +43,7 @@ def lookup(key, scope, order_override, resolution_type) # multiple times if the resolution type is array or hash but that # should be expected as the logging will then tell the user ALL the # places where the key is found. - Hiera.debug("Found #{key} in #{source}") + debug("Found #{key} in #{source}") # for array resolution we just append to the array whatever # we find, we then goes onto the next file and keep adding to @@ -71,9 +71,13 @@ def lookup(key, scope, order_override, resolution_type) private + def debug(message) + Hiera.debug("[eyaml_backend]: #{message}") + end + def decrypt(data) if encrypted?(data) - Hiera.debug("Attempting to decrypt") + debug("Attempting to decrypt") parser = Eyaml::Parser::ParserFactory.hiera_backend_parser tokens = parser.parse(data) @@ -117,7 +121,7 @@ def parse_options(scope) Config[:eyaml].each do |key, value| parsed_value = Backend.parse_string(value, scope) Eyaml::Options[key] = parsed_value - Hiera.debug("Set option: #{key} = #{parsed_value}") + debug("Set option: #{key} = #{parsed_value}") end Eyaml::Options[:source] = "hiera"