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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: e82ddbe3f7f7899124b06d0716ef1293cb96e5c9
4
- data.tar.gz: 06079d18c491c83c0e583d16ae7d1162076b4083
3
+ metadata.gz: c455e52f17ab0b1085015933c58d518978f8eab7
4
+ data.tar.gz: 7ca770c405ed90d63cb3887824884e3644dee6a3
5
5
  SHA512:
6
- metadata.gz: a3dc8f53705272d38954b79058a533f53588539b194f230f82336aba2a64b761eddd4c6edf59eabb5ee4064f20b96a438e4a31c2f9474f7c0eb802df9afa3ef8
7
- data.tar.gz: 79427991e49ab38d8af922abfd947a40336a78f9ed5c3ca3d83c20ec05c74817d1f1d0c0de9605e08f55c22528d06a485cc815d870c5eaa62d77baf519fcd7bb
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.0"
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 context
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 context
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
- throw :no_such_key unless found
69
+ if newer_hiera_version
70
+ throw :no_such_key unless found
71
+ end
69
72
  return answer
70
73
  end
71
74
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: hiera-yamll
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ version: 0.3.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Corey Osman