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 CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- NTMzYmYyODE0OWJlOTE5MjczNDYyNGVhNWQ0M2M2OWRkZmFmZGNjNQ==
4
+ YjgzNTg0MzE2ZjQzNTNhMjgxMWVlZjA3NTU4NDhkMzgyMmJmMWRhZA==
5
5
  data.tar.gz: !binary |-
6
- Yjg4ODRjZTBkZTdmY2U5MGQ3NjNiZGQ1MGJjMDliYTQ4YTVkNDgxNw==
6
+ NDUwNjA5ZDZmYzY5NTBlNjljNWQ1MTU5ZjZmMDJiYjRjODc5YzQ1OA==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- M2Q5MTI3NjAyMGUwNDFjOWY3NDY2YmUxNzU4ODQ2NTgwZjEzNGM5ODQyMGIz
10
- OWYyZGRhYTM3YmU4OWQ2NGZjOWYzMzQ4NGU5MzYzZjE0N2JiNTgwMmVjZDA2
11
- OTc2NGQ4OGMzZTcwZmE4NDBhN2E5YWVkNjY3Njk3M2VmMDEwMjI=
9
+ OTAxZTJmYWM1ODgxZGNjM2E2NjA4MDI3ODRmNTQ3NTJiNjhmNmM0OGFmMTk3
10
+ ZGQ4YTk1ZDhmM2Q2M2E3OTBhY2E0MmExMWVhNzRkMGEwOGU3MjMyNzc5YTU1
11
+ OTg2MmE4N2UxODI1YzNiOTBlMDdkZjcwN2Y0OTcyNjdhOGUxOWI=
12
12
  data.tar.gz: !binary |-
13
- YWJhZjdjNWIzZTMzYTBkMTljZmMwYTcxNjAwMmE2YjcxMzNhYzdkZGEyNTBm
14
- MDg2Yzg4ZTE2MWI0YWNkODA2ZTZlYmU1N2MxN2VlNTgzYTdjMDg1OGVmZGQz
15
- NGM0NWQxZTZhZmNkMzk4MjZhYzQ5ODNiNmNmMmZjZWE4ODIxZmY=
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
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: hiera-browser
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0.pre
4
+ version: 1.1.0.pre
5
5
  platform: ruby
6
6
  authors:
7
7
  - David Gwilliam