Giuseppe Lavagetto has submitted this change and it was merged. Change subject: hiera: complete transition in nuyaml backend ......................................................................
hiera: complete transition in nuyaml backend This allows us to simplify our code a fair bit. Bug: T147403 Change-Id: I99eaa3328241adb3244ea2cc909333763f852efc --- M modules/wmflib/lib/hiera/backend/nuyaml_backend.rb 1 file changed, 8 insertions(+), 14 deletions(-) Approvals: Giuseppe Lavagetto: Looks good to me, approved jenkins-bot: Verified diff --git a/modules/wmflib/lib/hiera/backend/nuyaml_backend.rb b/modules/wmflib/lib/hiera/backend/nuyaml_backend.rb index 791561a..ad01bf9 100644 --- a/modules/wmflib/lib/hiera/backend/nuyaml_backend.rb +++ b/modules/wmflib/lib/hiera/backend/nuyaml_backend.rb @@ -80,7 +80,7 @@ # Special case: regex if m = /^regex\//.match(source) Hiera.debug("Regex match going on - using regex.yaml") - return key, Backend.datafile(config_section, scope, 'regex', "yaml") + return Backend.datafile(config_section, scope, 'regex', "yaml") end # Special case: 'private' repository. @@ -106,19 +106,18 @@ # expansion. This is thought to allow large codebases to live # with fairly small yaml files as opposed to a very large one. # Example: - # $apache::mpm::worker => 'worker' in common/apache/mpm.yaml + # $apache::mpm::worker will be in common/apache/mpm.yaml paths = @expand_path.map{ |x| Backend.parse_string(x, scope) } if paths.include? source namespaces = key.gsub(/^::/,'').split('::') - newkey = namespaces.pop + namespaces.pop unless namespaces.empty? source += "/".concat(namespaces.join('/')) - key = newkey end end - return key, Backend.datafile(config_section, scope, source, "yaml") + return Backend.datafile(config_section, scope, source, "yaml") end def plain_lookup(key, data, scope) @@ -149,9 +148,9 @@ Backend.datasources(scope, order_override) do |source| Hiera.debug("Loading info from #{source} for #{key}") - lookup_key, yamlfile = get_path(key, scope, source) + yamlfile = get_path(key, scope, source) - Hiera.debug("Searching for #{lookup_key} in #{yamlfile}") + Hiera.debug("Searching for #{key} in #{yamlfile}") next if yamlfile.nil? @@ -167,13 +166,8 @@ if m = /regex\/(.*)$/.match(source) matchto = m[1] - new_answer = regex_lookup(lookup_key, matchto, data, scope) + new_answer = regex_lookup(key, matchto, data, scope) else - new_answer = plain_lookup(lookup_key, data, scope) - end - - # Transitional: look up the full qualified key in expand_path - if new_answer.nil? && lookup_key != key new_answer = plain_lookup(key, data, scope) end @@ -182,7 +176,7 @@ # 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 #{lookup_key} in #{source}") + Hiera.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 -- To view, visit https://gerrit.wikimedia.org/r/315202 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: merged Gerrit-Change-Id: I99eaa3328241adb3244ea2cc909333763f852efc Gerrit-PatchSet: 5 Gerrit-Project: operations/puppet Gerrit-Branch: production Gerrit-Owner: Giuseppe Lavagetto <glavage...@wikimedia.org> Gerrit-Reviewer: Giuseppe Lavagetto <glavage...@wikimedia.org> Gerrit-Reviewer: jenkins-bot <> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits