jerakia 1.1.1 → 1.1.2

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: c6acac89ddfc15c52ab520f40f8742b41bfff43c
4
- data.tar.gz: 3d38c1f23615cf0d768e1ee570c336eafc4dd305
3
+ metadata.gz: 691dd2bc7adfbd791cfff7d5e1e81721567d0684
4
+ data.tar.gz: 987421a97b12e0803be5562656d5c92b916ae326
5
5
  SHA512:
6
- metadata.gz: 8c7d34fa57d58252f3e8e60be1d4eee70e2bb5e96edb5667273394366eae282a9af473afcb298aee9c67a05789ff477411fe0405d92112d18af71d53c9152372
7
- data.tar.gz: d469edcfd9ac14665944b372e29f8533eed8bce3c507f04073056af67363ebf273bb650a211f4bc19a94ee11c70bf1f91502f2afe3fae5f4175e45554f38d94a
6
+ metadata.gz: 2e6dab70dc4cd75bd53a8e697c2dbca44a2de610f99d9f1da6875cd8b6a788caa9d2ab3ec4cd9367a1379929dc88b2e04caa3758eda7622b9097c410f8634764
7
+ data.tar.gz: acf4f2caacbbdd93d65a7225b7f1ae1777e4398993b23dd05e0ba6be5af6bd9dcc7eae2a9cb080916b6cacf2439481f7f3a435ea2d25ba5f453ab77f6b5576b2
@@ -1,3 +1,6 @@
1
+ require 'puppet'
2
+ require 'puppet/resource'
3
+
1
4
  class Hiera
2
5
  module Backend
3
6
  class Jerakia_backend
@@ -35,9 +38,9 @@ class Hiera
35
38
 
36
39
  metadata={}
37
40
  if scope.is_a?(Hash)
38
- metadata=scope
41
+ metadata=scope.reject { |k, v| v.is_a?(Puppet::Resource) }
39
42
  else
40
- metadata = scope.real.to_hash
43
+ metadata = scope.real.to_hash.reject { |k, v| v.is_a?(Puppet::Resource) }
41
44
  end
42
45
 
43
46
  request = Jerakia::Request.new(
data/lib/jerakia/cli.rb CHANGED
@@ -70,6 +70,11 @@ class Jerakia
70
70
 
71
71
 
72
72
  def lookup(key)
73
+ # Thor by default now returns a frozen options hash so we
74
+ # need to dup this here to prevent problems later with
75
+ # modifying the request object
76
+ #
77
+ options_copy = options.dup
73
78
 
74
79
  case true
75
80
  when options[:verbose]
@@ -92,15 +97,15 @@ class Jerakia
92
97
  :trace => options[:trace],
93
98
  })
94
99
  req = Jerakia::Request.new(
95
- :key => key,
96
- :namespace => options[:namespace].split(/::/),
97
- :policy => options[:policy].to_sym,
98
- :lookup_type => options[:type].to_sym,
99
- :merge => options[:merge_type].to_sym,
100
- :metadata => options[:metadata] || {},
101
- :scope => options[:scope].to_sym,
102
- :scope_options => options[:scope_options],
103
- :use_schema => options[:schema],
100
+ :key => key.dup,
101
+ :namespace => options_copy[:namespace].split(/::/),
102
+ :policy => options_copy[:policy].to_sym,
103
+ :lookup_type => options_copy[:type].to_sym,
104
+ :merge => options_copy[:merge_type].to_sym,
105
+ :metadata => options_copy[:metadata] || {},
106
+ :scope => options_copy[:scope].to_sym,
107
+ :scope_options => options_copy[:scope_options],
108
+ :use_schema => options_copy[:schema],
104
109
  )
105
110
 
106
111
 
@@ -27,8 +27,7 @@ class Jerakia::Policy
27
27
  end
28
28
 
29
29
  def clone_request
30
- copy_request = request.clone
31
- return copy_request
30
+ Marshal.load(Marshal.dump(request))
32
31
  end
33
32
 
34
33
  def submit_lookup(lookup)
@@ -4,6 +4,6 @@ class Jerakia
4
4
  #
5
5
  # This should be updated when a new gem is released and it is read from the gemspec file
6
6
  #
7
- VERSION = "1.1.1"
7
+ VERSION = "1.1.2"
8
8
 
9
9
  end
@@ -19,7 +19,7 @@ class Puppet::DataBinding::Jerakia < Puppet::Indirector::Code
19
19
  lookupdata=request.key.split(/::/)
20
20
  key=lookupdata.pop
21
21
  namespace=lookupdata
22
- metadata = request.options[:variables].to_hash
22
+ metadata = request.options[:variables].to_hash.reject { |k, v| v.is_a?(Puppet::Resource) }
23
23
  policy=metadata["jerakia_policy"] || @default_policy
24
24
  jacreq = Jerakia::Request.new(
25
25
  :key => key,
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jerakia
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.1
4
+ version: 1.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Craig Dunn
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-08-30 00:00:00.000000000 Z
11
+ date: 2016-08-31 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: thor