Giuseppe Lavagetto has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/315202

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, 5 insertions(+), 11 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/operations/puppet 
refs/changes/02/315202/1

diff --git a/modules/wmflib/lib/hiera/backend/nuyaml_backend.rb 
b/modules/wmflib/lib/hiera/backend/nuyaml_backend.rb
index 791561a..bb73035 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,7 +148,7 @@
         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}")
 
@@ -170,11 +169,6 @@
             new_answer = regex_lookup(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
 
           next if new_answer.nil?

-- 
To view, visit https://gerrit.wikimedia.org/r/315202
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I99eaa3328241adb3244ea2cc909333763f852efc
Gerrit-PatchSet: 1
Gerrit-Project: operations/puppet
Gerrit-Branch: production
Gerrit-Owner: Giuseppe Lavagetto <glavage...@wikimedia.org>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to