hiera-router 0.2.2 → 0.2.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/hiera/backend/router_backend.rb +17 -3
- metadata +2 -2
    
        checksums.yaml
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            ---
         | 
| 2 2 | 
             
            SHA1:
         | 
| 3 | 
            -
              metadata.gz:  | 
| 4 | 
            -
              data.tar.gz:  | 
| 3 | 
            +
              metadata.gz: f008fd079d6bf63f1a897eb53b1d42338152aa6b
         | 
| 4 | 
            +
              data.tar.gz: adcbbf85adce23472dc99cfcf36689711a9f26a9
         | 
| 5 5 | 
             
            SHA512:
         | 
| 6 | 
            -
              metadata.gz:  | 
| 7 | 
            -
              data.tar.gz:  | 
| 6 | 
            +
              metadata.gz: 7674d2308f350a7a1defddca3acf39025f1faf745dc9a9a18088366e815d25b091016ec20323b7dff84921bceee47f5a9870689e4472c40f548b5ecd4ba5a973
         | 
| 7 | 
            +
              data.tar.gz: 4e208e39b5841e419d394ad4df518829a3db737844bd5cca2d878c6445fe1213ebbf04470057601a9eadf79a74a91c01b6703885141bf4fd3314c451ff3d88e9
         | 
| @@ -67,7 +67,19 @@ class Hiera | |
| 67 67 | 
             
            				return answer
         | 
| 68 68 | 
             
            			end
         | 
| 69 69 |  | 
| 70 | 
            -
            			def  | 
| 70 | 
            +
            			def hash_key(hash, path)
         | 
| 71 | 
            +
            				puts hash.inspect
         | 
| 72 | 
            +
            				puts path.join('>')
         | 
| 73 | 
            +
            				my_hash = hash
         | 
| 74 | 
            +
            				path.each do |key|
         | 
| 75 | 
            +
            					my_hash = my_hash[key] if my_hash.include?(key)
         | 
| 76 | 
            +
            				end
         | 
| 77 | 
            +
             | 
| 78 | 
            +
            				puts "result: #{my_hash}"
         | 
| 79 | 
            +
            				return my_hash
         | 
| 80 | 
            +
            			end
         | 
| 81 | 
            +
             | 
| 82 | 
            +
            			def parse_answer(data, scope, options, path = [])
         | 
| 71 83 | 
             
            				if data.is_a?(Numeric) or data.is_a?(TrueClass) or data.is_a?(FalseClass)
         | 
| 72 84 | 
             
            					return data
         | 
| 73 85 | 
             
            				elsif data.is_a?(String)
         | 
| @@ -76,7 +88,8 @@ class Hiera | |
| 76 88 | 
             
            					answer = {}
         | 
| 77 89 | 
             
            					data.each_pair do |key, val|
         | 
| 78 90 | 
             
            						interpolated_key = Backend.parse_string(key, scope)
         | 
| 79 | 
            -
            						 | 
| 91 | 
            +
            						subpath = path + [interpolated_key]
         | 
| 92 | 
            +
            						answer[interpolated_key] = hash_key(parse_answer(val, scope, options, subpath), subpath)
         | 
| 80 93 | 
             
            					end
         | 
| 81 94 |  | 
| 82 95 | 
             
            					return answer
         | 
| @@ -99,7 +112,8 @@ class Hiera | |
| 99 112 | 
             
            					if backend = backends[backend_name]
         | 
| 100 113 | 
             
            						result = backend.lookup(backend_options[:key], backend_options[:scope], nil, backend_options[:resolution_type])
         | 
| 101 114 | 
             
            					else
         | 
| 102 | 
            -
            						 | 
| 115 | 
            +
            						Hiera.warn "Backend '#{backend_name}' was not configured; returning the data as-is."
         | 
| 116 | 
            +
            						result = data
         | 
| 103 117 | 
             
            					end
         | 
| 104 118 | 
             
            					Hiera.debug("[hiera-router] Call to '#{backend_name}' finished.")
         | 
| 105 119 | 
             
            					return result
         | 
    
        metadata
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            --- !ruby/object:Gem::Specification
         | 
| 2 2 | 
             
            name: hiera-router
         | 
| 3 3 | 
             
            version: !ruby/object:Gem::Version
         | 
| 4 | 
            -
              version: 0.2. | 
| 4 | 
            +
              version: 0.2.3
         | 
| 5 5 | 
             
            platform: ruby
         | 
| 6 6 | 
             
            authors:
         | 
| 7 7 | 
             
            - Jo Vandeginste
         | 
| @@ -9,7 +9,7 @@ authors: | |
| 9 9 | 
             
            autorequire: 
         | 
| 10 10 | 
             
            bindir: bin
         | 
| 11 11 | 
             
            cert_chain: []
         | 
| 12 | 
            -
            date: 2016- | 
| 12 | 
            +
            date: 2016-07-04 00:00:00.000000000 Z
         | 
| 13 13 | 
             
            dependencies: []
         | 
| 14 14 | 
             
            description: |
         | 
| 15 15 | 
             
              This hiera backend replaces the default yaml backend, but will resend queries to other hiera backends based on the value returned by the yaml files.
         |