confidante 0.28.0.pre.16 → 0.28.0.pre.20
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +5 -5
- data/Rakefile +1 -1
- data/lib/confidante/version.rb +1 -1
- data/lib/hiera/backend/vault_backend.rb +26 -10
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f1bfb2c0fa603d1a89d220fd4c54dc97fb1ef1a00447ceabfe657e9dfb1d4e29
|
4
|
+
data.tar.gz: 98ebe1930702415a5f6fc09fc206d165498dcbb0696b00cd387b9ff0baa75924
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5e5278e02d47658641d1ce61d9f147a60cebae653792bbfdf09bf8641e0034087fbf5059da792ddb39a3ec67764e435e3aeb04a5dd204f592991d9443a2152fa
|
7
|
+
data.tar.gz: 248b245aa62c7005f8de4939351a63cf80f84b9d6561885e1cdbc70d81abf9cc137bfe2071dd009bd620b542af280d5c90b41d6ca64b15dc85508dbe0dc497fa
|
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
confidante (0.28.0.pre.
|
4
|
+
confidante (0.28.0.pre.20)
|
5
5
|
activesupport (>= 4)
|
6
6
|
hiera (~> 3.3)
|
7
7
|
shikashi (~> 0.6)
|
@@ -113,7 +113,7 @@ GEM
|
|
113
113
|
diff-lcs (>= 1.2.0, < 2.0)
|
114
114
|
rspec-support (~> 3.11.0)
|
115
115
|
rspec-support (3.11.0)
|
116
|
-
rubocop (1.
|
116
|
+
rubocop (1.36.0)
|
117
117
|
json (~> 2.3)
|
118
118
|
parallel (~> 1.10)
|
119
119
|
parser (>= 3.1.2.1)
|
@@ -136,12 +136,12 @@ GEM
|
|
136
136
|
sexp_processor (~> 4.6)
|
137
137
|
ruby_gpg2 (0.8.0)
|
138
138
|
lino (>= 1.5)
|
139
|
-
ruby_parser (3.
|
139
|
+
ruby_parser (3.19.1)
|
140
140
|
sexp_processor (~> 4.16)
|
141
141
|
sawyer (0.8.2)
|
142
142
|
addressable (>= 2.3.5)
|
143
143
|
faraday (> 0.8, < 2.0)
|
144
|
-
sexp_processor (4.16.
|
144
|
+
sexp_processor (4.16.1)
|
145
145
|
shikashi (0.6.0)
|
146
146
|
evalhook (>= 0.6.0)
|
147
147
|
getsource (>= 0.1.0)
|
@@ -180,4 +180,4 @@ DEPENDENCIES
|
|
180
180
|
simplecov
|
181
181
|
|
182
182
|
BUNDLED WITH
|
183
|
-
2.3.
|
183
|
+
2.3.21
|
data/Rakefile
CHANGED
data/lib/confidante/version.rb
CHANGED
@@ -16,22 +16,38 @@ class Hiera
|
|
16
16
|
"with #{resolution_type}")
|
17
17
|
|
18
18
|
vault_config = Backend.parse_answer(Config[:vault], scope)
|
19
|
-
vault_address = vault_config[:address]
|
20
|
-
vault_client = Vault::Client.new(address: vault_address)
|
21
19
|
|
22
|
-
|
20
|
+
if valid_vault_address?(vault_config)
|
21
|
+
Hiera.warn('No vault address provided. Skipping lookup!')
|
22
|
+
nil
|
23
|
+
else
|
24
|
+
Backend.parse_answer(get_value(vault_config, key), scope)
|
25
|
+
end
|
26
|
+
end
|
23
27
|
|
24
|
-
|
28
|
+
def valid_vault_address?(vault_config)
|
29
|
+
vault_address = vault_config[:address]
|
30
|
+
vault_address.nil? || vault_address.empty?
|
25
31
|
end
|
26
32
|
|
27
|
-
def get_value(
|
28
|
-
|
29
|
-
|
30
|
-
|
33
|
+
def get_value(vault_config, key)
|
34
|
+
vault_address = vault_config[:address]
|
35
|
+
vault_client = Vault::Client.new(address: vault_address)
|
36
|
+
get_first_value_from_sources(
|
37
|
+
vault_client,
|
38
|
+
key,
|
39
|
+
vault_config[:sources]
|
40
|
+
)
|
41
|
+
end
|
31
42
|
|
32
|
-
|
43
|
+
def get_first_value_from_sources(vault_client, key, sources)
|
44
|
+
sources.each do |source|
|
45
|
+
value = read_kv_value(vault_client, source, key)
|
46
|
+
|
47
|
+
return value if value
|
48
|
+
end
|
33
49
|
|
34
|
-
|
50
|
+
throw(:no_such_key)
|
35
51
|
end
|
36
52
|
|
37
53
|
def read_kv_value(vault_client, source, key)
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: confidante
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.28.0.pre.
|
4
|
+
version: 0.28.0.pre.20
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- InfraBlocks Maintainers
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-
|
11
|
+
date: 2022-09-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|