hiera-yamll 0.3.0 → 0.3.1
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/yamll_backend.rb +7 -4
- 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: c455e52f17ab0b1085015933c58d518978f8eab7
|
4
|
+
data.tar.gz: 7ca770c405ed90d63cb3887824884e3644dee6a3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1e9c3a16a6a69e4eb19167b6acdf6c50c69c9cb4b251ec4aa22748f8e44a015bdff85a47e9bfe5971a2f1131f302081ff44a9dfd17399a10fff18876d79d769a
|
7
|
+
data.tar.gz: 79ef872302bb48d73412033cc1cff4391c502fcc4363d524a3425ce5ed3b528c011cd995c07ec9cc983e11efeda6a94b315729209a29333cca24f680cb00d67b
|
@@ -2,7 +2,7 @@ require 'hiera'
|
|
2
2
|
class Hiera
|
3
3
|
module Backend
|
4
4
|
class Yamll_backend
|
5
|
-
VERSION = "0.3.
|
5
|
+
VERSION = "0.3.1"
|
6
6
|
# This is left blank because we are hacking hiera backend logic
|
7
7
|
# to get around a limitation of hiera where you cannot have
|
8
8
|
# multiple backends of the same type.
|
@@ -19,6 +19,7 @@ class Hiera
|
|
19
19
|
def lookup(key, scope, order_override, resolution_type, context=nil)
|
20
20
|
answer = nil
|
21
21
|
found = false
|
22
|
+
newer_hiera_version = Hiera::VERSION >= '3.0.0'
|
22
23
|
|
23
24
|
Hiera.debug("Looking up #{key} in YAMLL backend")
|
24
25
|
Backend.datasourcefiles(:yamll, scope, "yaml", order_override) do |source, yamlfile|
|
@@ -41,7 +42,7 @@ class Hiera
|
|
41
42
|
# the array
|
42
43
|
#
|
43
44
|
# for priority searches we break after the first found data item
|
44
|
-
if
|
45
|
+
if newer_hiera_version
|
45
46
|
# versions of newer hiera use a context
|
46
47
|
new_answer = Backend.parse_answer(data[key], scope, {}, context)
|
47
48
|
else
|
@@ -55,7 +56,7 @@ class Hiera
|
|
55
56
|
when :hash
|
56
57
|
raise Exception, "Hiera type mismatch for key '#{key}': expected Hash and got #{new_answer.class}" unless new_answer.kind_of? Hash
|
57
58
|
answer ||= {}
|
58
|
-
if
|
59
|
+
if newer_hiera_version
|
59
60
|
answer = Backend.merge_answer(new_answer, answer, resolution_type)
|
60
61
|
else
|
61
62
|
answer = Backend.merge_answer(new_answer, answer)
|
@@ -65,7 +66,9 @@ class Hiera
|
|
65
66
|
break
|
66
67
|
end
|
67
68
|
end
|
68
|
-
|
69
|
+
if newer_hiera_version
|
70
|
+
throw :no_such_key unless found
|
71
|
+
end
|
69
72
|
return answer
|
70
73
|
end
|
71
74
|
end
|