hiera-browser 1.0.0.pre → 1.1.0.pre
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +8 -8
- data/lib/hiera_browser/hiera_controller.rb +21 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
YjgzNTg0MzE2ZjQzNTNhMjgxMWVlZjA3NTU4NDhkMzgyMmJmMWRhZA==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
NDUwNjA5ZDZmYzY5NTBlNjljNWQ1MTU5ZjZmMDJiYjRjODc5YzQ1OA==
|
7
7
|
SHA512:
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
OTAxZTJmYWM1ODgxZGNjM2E2NjA4MDI3ODRmNTQ3NTJiNjhmNmM0OGFmMTk3
|
10
|
+
ZGQ4YTk1ZDhmM2Q2M2E3OTBhY2E0MmExMWVhNzRkMGEwOGU3MjMyNzc5YTU1
|
11
|
+
OTg2MmE4N2UxODI1YzNiOTBlMDdkZjcwN2Y0OTcyNjdhOGUxOWI=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
NTI1MTNkMzdhZjJkNjY5MmQxODllOGE2OGQwY2IyMWFiY2FjZDAyYzg1MWQy
|
14
|
+
MTNjYzlmZmM4YTI4NTFhMzdkNWRiMjY4OTM3Mjc3ZmI3MmE4NjMyMzRlMGFl
|
15
|
+
NzIzNTA5MTQ5YjBiNmQ4ZmY1ZDI5MmU1MmMwM2YxYjA4MDQwMWY=
|
@@ -35,9 +35,29 @@ class HieraController
|
|
35
35
|
config[:hierarchy]
|
36
36
|
end
|
37
37
|
|
38
|
+
def top_scopify(args)
|
39
|
+
scope = args[:scope]
|
40
|
+
fix_keys = hierarchy.map{|datasource|
|
41
|
+
begin
|
42
|
+
datasource.match(/\%\{([\:a-z_]+)\}/)[1]
|
43
|
+
rescue NoMethodError
|
44
|
+
datasource
|
45
|
+
end
|
46
|
+
}
|
47
|
+
fix_keys.select!{|datasource| datasource.start_with?("::")} unless fix_keys.empty?
|
48
|
+
scope.inject({}){|a,fact|
|
49
|
+
if fix_keys.include?("::#{fact.first}")
|
50
|
+
a["::#{fact.first}"] = fact.last
|
51
|
+
else
|
52
|
+
a[fact.first] = fact.last
|
53
|
+
end
|
54
|
+
a
|
55
|
+
}
|
56
|
+
end
|
57
|
+
|
38
58
|
def lookup(args)
|
39
59
|
key = args[:key]
|
40
|
-
scope = args[:scope]
|
60
|
+
scope = top_scopify(:scope => args[:scope])
|
41
61
|
resolution_type = args[:resolution_type] || :priority
|
42
62
|
Hash[*[key,hiera.lookup(key, nil, scope, nil, resolution_type)]]
|
43
63
|
end
|