jerakia-puppet 0.1.0 → 0.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/hiera/backend/jerakiaserver_backend.rb +14 -4
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 875d58d53bb4cd5560e95f2b92888dbca11a1bd6
|
4
|
+
data.tar.gz: ee1b8adabebf3082584ec3b163a4788dc81355d5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d43552fb39f2a59ae6ece67607f8e23f7f3ee63a08168a66bb0ac93d4517878767201e1d393a476dbedc48497254fe8f2bd41ae6b28c7c5729cf287dfd16a777
|
7
|
+
data.tar.gz: 4d196f0d6a500232789c1eb8d833b9208778b19b43f70c3c3079c9e75e14ff6c6f8017eb9a7ab1b9092efb711a01f93371e09e718449605c5c1f1700f17ec975
|
@@ -4,10 +4,9 @@ require 'jerakia/client'
|
|
4
4
|
|
5
5
|
class Hiera
|
6
6
|
module Backend
|
7
|
-
class
|
7
|
+
class Jerakiaserver_backend
|
8
8
|
|
9
9
|
def initialize(config = nil)
|
10
|
-
require 'jerakia'
|
11
10
|
@config = config || Hiera::Config[:jerakia] || {}
|
12
11
|
@jerakia = ::Jerakia::Client.new
|
13
12
|
@scope_cache = {}
|
@@ -81,7 +80,7 @@ class Hiera
|
|
81
80
|
:namespace => namespace,
|
82
81
|
:scope => 'server',
|
83
82
|
:lookup_type => lookup_type.to_s,
|
84
|
-
:
|
83
|
+
:merge => merge_type.to_s,
|
85
84
|
:scope_opts => {
|
86
85
|
'identifier' => identifier,
|
87
86
|
'realm' => 'puppet'
|
@@ -97,7 +96,18 @@ class Hiera
|
|
97
96
|
|
98
97
|
if lookup.is_a?(Hash)
|
99
98
|
raise Puppet::Error, "Jerakia data lookup failed #{lookup['message']}" unless lookup['status'] = 'ok'
|
100
|
-
|
99
|
+
|
100
|
+
payload = lookup['payload']
|
101
|
+
case resolution_type
|
102
|
+
when :array
|
103
|
+
return [] if payload.nil?
|
104
|
+
return payload
|
105
|
+
when :hash
|
106
|
+
return {} if payload.nil?
|
107
|
+
return payload
|
108
|
+
else
|
109
|
+
return payload
|
110
|
+
end
|
101
111
|
else
|
102
112
|
raise Puppet::Error, "Jerakia data lookup failed Expected a hash but got a #{lookup.class}"
|
103
113
|
end
|