confidante 0.28.0.pre.14 → 0.28.0.pre.17
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +4 -3
- data/lib/confidante/version.rb +1 -1
- data/lib/hiera/backend/vault_backend.rb +25 -5
- 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: 94d4ad7adeb2f7f50922b57bbcb7112754b76c8c14c1deec0f6e6c976ef746bc
|
4
|
+
data.tar.gz: 720f5ad0310855b2c45babda8fef3a0a2a31457a43e836a384c690ddc781b8b5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: bcb0aaf12c349634d99b098d74fff4eceb293105f9a763e6651f3ff85af907b865d87e3e16fd68b57c8db368b641977f705705969de78e4b1030621f559f45b0
|
7
|
+
data.tar.gz: 60436dbd48b8ec6e338a407381acaa839361e3b658216f81d70f2786b06a159c985cc992f8614ded82516ef8a0d51afbbbf32190b30a8b0a31a95b7147227dc1
|
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.17)
|
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.35.
|
116
|
+
rubocop (1.35.1)
|
117
117
|
json (~> 2.3)
|
118
118
|
parallel (~> 1.10)
|
119
119
|
parser (>= 3.1.2.1)
|
@@ -161,6 +161,7 @@ GEM
|
|
161
161
|
PLATFORMS
|
162
162
|
arm64-darwin-21
|
163
163
|
x86_64-darwin-20
|
164
|
+
x86_64-darwin-21
|
164
165
|
x86_64-linux
|
165
166
|
|
166
167
|
DEPENDENCIES
|
@@ -179,4 +180,4 @@ DEPENDENCIES
|
|
179
180
|
simplecov
|
180
181
|
|
181
182
|
BUNDLED WITH
|
182
|
-
2.3.
|
183
|
+
2.3.21
|
data/lib/confidante/version.rb
CHANGED
@@ -17,17 +17,37 @@ class Hiera
|
|
17
17
|
|
18
18
|
vault_config = Backend.parse_answer(Config[:vault], scope)
|
19
19
|
vault_address = vault_config[:address]
|
20
|
+
|
21
|
+
throw :no_vault_address_provided unless vault_address
|
22
|
+
|
20
23
|
vault_client = Vault::Client.new(address: vault_address)
|
24
|
+
value = get_value(vault_client, key, vault_config[:sources])
|
25
|
+
Backend.parse_answer(value, scope)
|
26
|
+
end
|
21
27
|
|
22
|
-
|
23
|
-
|
28
|
+
def get_value(vault_client, key, sources)
|
29
|
+
found_source = sources.find do |source|
|
30
|
+
read_kv_value(vault_client, source, key)
|
31
|
+
end
|
24
32
|
|
25
|
-
|
26
|
-
throw(:no_such_key) unless value
|
33
|
+
throw(:no_such_key) unless found_source
|
27
34
|
|
28
|
-
|
35
|
+
read_kv_value(vault_client, found_source, key)
|
36
|
+
end
|
37
|
+
|
38
|
+
def read_kv_value(vault_client, source, key)
|
39
|
+
throw(:unsupported_secrets_engine) unless source[:engine] == 'kv'
|
40
|
+
|
41
|
+
mount = source[:mount]
|
42
|
+
full_path = "#{source[:path]}/#{key}"
|
43
|
+
|
44
|
+
secret = vault_client.kv(mount).read(full_path)
|
45
|
+
return nil unless secret
|
46
|
+
|
47
|
+
secret.data[:value]
|
29
48
|
end
|
30
49
|
end
|
50
|
+
|
31
51
|
# rubocop:enable Naming/ClassAndModuleCamelCase
|
32
52
|
end
|
33
53
|
end
|
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.17
|
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-08-
|
11
|
+
date: 2022-08-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|