hiera-router 0.5.2 → 0.5.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/hiera/backend/router_backend.rb +6 -3
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 762d8c3ebcb99e8264b85a86582d132e93816c35
|
4
|
+
data.tar.gz: 5cfdcc149d1515740b49d387e9c3fba04e016372
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c52827a2ac81a1164d06f217c633ff1e19620cec72a1550ba2d92e6f10f2d911594022f0db135875d897e171fe336bd7beb6fd8b985a09ff64fabefab39f7ff0
|
7
|
+
data.tar.gz: b0c5a1703a81ca7dd677e4939ad1b00a6669cb27ec92cbb588ecaaed64582835c1131917a686d48d0463994db5227a269395c14fdb740c60595a46d1a2b7a70b
|
@@ -72,7 +72,7 @@ class Hiera
|
|
72
72
|
:resolution_type => resolution_type,
|
73
73
|
}
|
74
74
|
|
75
|
-
key_path =
|
75
|
+
key_path = Util.split_key(lookup_key)
|
76
76
|
key = key_path.shift
|
77
77
|
|
78
78
|
cache_key = options.to_s
|
@@ -81,6 +81,7 @@ class Hiera
|
|
81
81
|
return cached_value[:value] if cached_value[:time] > Time.now - @cache_time
|
82
82
|
end
|
83
83
|
answer = nil
|
84
|
+
strategy = resolution_type.is_a?(Hash) ? :hash : resolution_type
|
84
85
|
|
85
86
|
Hiera.debug("[hiera-router] Looking up #{key} in yaml backend (and then return path #{key_path.inspect})")
|
86
87
|
|
@@ -105,7 +106,7 @@ class Hiera
|
|
105
106
|
new_answer = parse_answer(data[key], scope, options)
|
106
107
|
next if new_answer.nil?
|
107
108
|
|
108
|
-
case
|
109
|
+
case strategy
|
109
110
|
when :array
|
110
111
|
raise Exception, "Hiera type mismatch: expected Array and got #{new_answer.class}" unless new_answer.kind_of? Array or new_answer.kind_of? String
|
111
112
|
answer ||= []
|
@@ -113,7 +114,7 @@ class Hiera
|
|
113
114
|
when :hash
|
114
115
|
raise Exception, "Hiera type mismatch: expected Hash and got #{new_answer.class}" unless new_answer.kind_of? Hash
|
115
116
|
answer ||= {}
|
116
|
-
answer = Backend.merge_answer(new_answer,answer)
|
117
|
+
answer = Backend.merge_answer(new_answer, answer, resolution_type)
|
117
118
|
else
|
118
119
|
answer = new_answer
|
119
120
|
break
|
@@ -125,6 +126,8 @@ class Hiera
|
|
125
126
|
answer = answer[e]
|
126
127
|
end
|
127
128
|
|
129
|
+
answer = Backend.resolve_answer(answer, strategy) unless answer.nil?
|
130
|
+
|
128
131
|
@bigcache[cache_key] = {
|
129
132
|
:value => answer,
|
130
133
|
:time => Time.now,
|