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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 8acc6c75c3de393f31c3354966b5dcbf57e1fea5
4
- data.tar.gz: d0067460a22e3eef04bfc901a909b1f570986a71
3
+ metadata.gz: 762d8c3ebcb99e8264b85a86582d132e93816c35
4
+ data.tar.gz: 5cfdcc149d1515740b49d387e9c3fba04e016372
5
5
  SHA512:
6
- metadata.gz: 01b9ef533ad0a1b2fc229f2e10b0b0cc7f2ce79f7da8d5f904a304bba36a7d862b6b42fd91ca5446f024e6c7431bf95c6250c9c632bd507196d38c28779dd3c4
7
- data.tar.gz: 9369764493189bfb644e2c382e247eb55c26c6666b45bb71862d1f3f6da63aaa93ccbc1599446a8323ff9c560b4a03d2c7d08250ee504aa744b088a73e7aed98
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 = Hiera::Util.split_key(lookup_key)
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 resolution_type
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,
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.5.2
4
+ version: 0.5.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jo Vandeginste