<commit_before># This plugin reformats the lookup key according to a puppet's
# Hiera system, so instead of looking up <key> in <path>/<namespace>.yaml
# we lookup <namespace>::<key> in <path>.yaml
#
# This is a useful plugin for people wanting to test drive Jerakia
# but maintain an existing hiera filesystem layout and naming convention
# within the source data.
#
class Jerakia::Lookup::Plugin
  module Hiera

    def autorun
      request.key.prepend("#{request.namespace.join('::')}::")
      request.namespace=[]
    end

    def rewrite_lookup
      Jerakia.log.debug("DEPRECATION NOTICE: The use of plugin.hiera.rewrite_lookup is now deprecated and is automatically executed when the plugin is loaded")
    end

    def calling_module
      if request.namespace.length > 0
        request.namespace[0]
      else
        Jerakia.log.error("hiera_compat plugin tried to use calling_module but there is no namespace declared.  Ensure that calling_module is called before hiera_compat in the policy")
      end
    end
  end
end

<commit_msg>Do not prepend "::" to keys when there is no namespace<commit_after># This plugin reformats the lookup key according to a puppet's
# Hiera system, so instead of looking up <key> in <path>/<namespace>.yaml
# we lookup <namespace>::<key> in <path>.yaml
#
# This is a useful plugin for people wanting to test drive Jerakia
# but maintain an existing hiera filesystem layout and naming convention
# within the source data.
#
class Jerakia::Lookup::Plugin
  module Hiera

    def autorun
      if request.namespace.length > 0
        request.key.prepend("#{request.namespace.join('::')}::")
      end
      request.namespace=[]
    end

    def rewrite_lookup
      Jerakia.log.debug("DEPRECATION NOTICE: The use of plugin.hiera.rewrite_lookup is now deprecated and is automatically executed when the plugin is loaded")
    end

    def calling_module
      if request.namespace.length > 0
        request.namespace[0]
      else
        Jerakia.log.error("hiera_compat plugin tried to use calling_module but there is no namespace declared.  Ensure that calling_module is called before hiera_compat in the policy")
      end
    end
  end
end
{'fraction_non_alphanumeric': 0.07643020594965676, 'fraction_numerical': 0.002288329519450801, 'mean_word_length': 3.5165289256198347, 'pattern_counts': {'":': 1, '<': 15, '<?xml version=': 0, '>': 18, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6699886', 'n_tokens_mistral': 612, 'n_tokens_neox': 586, 'n_words': 243}