confidante 0.28.0.pre.12 → 0.28.0.pre.15

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
  SHA256:
3
- metadata.gz: fb57c8d60214b57bc0c20c165047ebf557f6252dbb3be1ec48466a97d7f45369
4
- data.tar.gz: b3e3bd926e765a325b75ad1eb8a9c6d114a5546cc70318d8f8392ce0ac45b9d7
3
+ metadata.gz: 9650fc6b5cfb60cde80bd5d25dde663535bca870a8f9b08ce29eb9c2375be8f7
4
+ data.tar.gz: 17cc9dd25523d6415681f1fcda2b8036c94360b4927fa97dd5532e1bfc3386e8
5
5
  SHA512:
6
- metadata.gz: d5245cb848efa5f5c3051c52457ef6c37acde9d12319ede508e91949bb6a2cc4469e0296efc22d44b98d804855e7e82f796fa3eae630cf11b9bc221f4456e6f6
7
- data.tar.gz: cbed95fbeff72f3e618f20c719335a861696674dc95e3256258e3174f781ea398ac5a8d730a635c160129e8916f2331d1638c42244d091bbd81a37f0d6df8854
6
+ metadata.gz: 8a81fed1309c40c7f52fac384b1f084ad7f1a8352adc031aed918d780f7d072436007f12571fe8c739173f35f6b834073bb1e67efc4441ac4d085fda3e57d642
7
+ data.tar.gz: e8eb70b0f2246395a497ade451252cf05d762bad52d2128f6ce50360ba20709f8921de4059202d19463641dc39dbb10a8c7f5fce7f9f81d1248e7567721abe4c
data/Gemfile.lock CHANGED
@@ -1,15 +1,16 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- confidante (0.28.0.pre.12)
4
+ confidante (0.28.0.pre.15)
5
5
  activesupport (>= 4)
6
6
  hiera (~> 3.3)
7
7
  shikashi (~> 0.6)
8
+ vault (~> 0.17)
8
9
 
9
10
  GEM
10
11
  remote: https://rubygems.org/
11
12
  specs:
12
- activesupport (7.0.2.3)
13
+ activesupport (7.0.3.1)
13
14
  concurrent-ruby (~> 1.0, >= 1.0.2)
14
15
  i18n (>= 1.6, < 2)
15
16
  minitest (>= 5.1)
@@ -17,8 +18,11 @@ GEM
17
18
  addressable (2.8.0)
18
19
  public_suffix (>= 2.0.2, < 5.0)
19
20
  ast (2.4.2)
21
+ aws-eventstream (1.2.0)
22
+ aws-sigv4 (1.5.1)
23
+ aws-eventstream (~> 1, >= 1.0.2)
20
24
  colored2 (3.1.2)
21
- concurrent-ruby (1.1.9)
25
+ concurrent-ruby (1.1.10)
22
26
  diff-lcs (1.5.0)
23
27
  docile (1.4.0)
24
28
  evalhook (0.6.0)
@@ -52,20 +56,21 @@ GEM
52
56
  getsource (0.2.2)
53
57
  hamster (3.0.0)
54
58
  concurrent-ruby (~> 1.0)
55
- hiera (3.8.0)
56
- i18n (1.10.0)
59
+ hiera (3.10.0)
60
+ i18n (1.11.0)
57
61
  concurrent-ruby (~> 1.0)
62
+ json (2.6.2)
58
63
  lino (3.0.0)
59
64
  hamster (~> 3.0)
60
65
  open4 (~> 1.3)
61
- minitest (5.15.0)
66
+ minitest (5.16.2)
62
67
  multipart-post (2.1.1)
63
68
  octokit (4.22.0)
64
69
  faraday (>= 0.9)
65
70
  sawyer (~> 0.8.0, >= 0.5.3)
66
71
  open4 (1.3.4)
67
- parallel (1.22.0)
68
- parser (3.1.1.0)
72
+ parallel (1.22.1)
73
+ parser (3.1.2.1)
69
74
  ast (~> 2.4.1)
70
75
  partialruby (0.3.0)
71
76
  ruby2ruby (~> 2)
@@ -93,7 +98,7 @@ GEM
93
98
  colored2 (~> 3.1)
94
99
  rake_factory (~> 0.23)
95
100
  sshkey (~> 2.0)
96
- regexp_parser (2.2.1)
101
+ regexp_parser (2.5.0)
97
102
  rexml (3.2.5)
98
103
  rspec (3.11.0)
99
104
  rspec-core (~> 3.11.0)
@@ -108,21 +113,22 @@ GEM
108
113
  diff-lcs (>= 1.2.0, < 2.0)
109
114
  rspec-support (~> 3.11.0)
110
115
  rspec-support (3.11.0)
111
- rubocop (1.26.1)
116
+ rubocop (1.35.0)
117
+ json (~> 2.3)
112
118
  parallel (~> 1.10)
113
- parser (>= 3.1.0.0)
119
+ parser (>= 3.1.2.1)
114
120
  rainbow (>= 2.2.2, < 4.0)
115
121
  regexp_parser (>= 1.8, < 3.0)
116
- rexml
117
- rubocop-ast (>= 1.16.0, < 2.0)
122
+ rexml (>= 3.2.5, < 4.0)
123
+ rubocop-ast (>= 1.20.1, < 2.0)
118
124
  ruby-progressbar (~> 1.7)
119
125
  unicode-display_width (>= 1.4.0, < 3.0)
120
- rubocop-ast (1.16.0)
126
+ rubocop-ast (1.21.0)
121
127
  parser (>= 3.1.1.0)
122
128
  rubocop-rake (0.6.0)
123
129
  rubocop (~> 1.0)
124
- rubocop-rspec (2.9.0)
125
- rubocop (~> 1.19)
130
+ rubocop-rspec (2.12.1)
131
+ rubocop (~> 1.31)
126
132
  ruby-progressbar (1.11.0)
127
133
  ruby2_keywords (0.0.5)
128
134
  ruby2ruby (2.4.4)
@@ -148,10 +154,14 @@ GEM
148
154
  sshkey (2.0.0)
149
155
  tzinfo (2.0.4)
150
156
  concurrent-ruby (~> 1.0)
151
- unicode-display_width (2.1.0)
157
+ unicode-display_width (2.2.0)
158
+ vault (0.17.0)
159
+ aws-sigv4
152
160
 
153
161
  PLATFORMS
154
162
  arm64-darwin-21
163
+ x86_64-darwin-20
164
+ x86_64-darwin-21
155
165
  x86_64-linux
156
166
 
157
167
  DEPENDENCIES
@@ -170,4 +180,4 @@ DEPENDENCIES
170
180
  simplecov
171
181
 
172
182
  BUNDLED WITH
173
- 2.3.10
183
+ 2.3.20
data/confidante.gemspec CHANGED
@@ -41,6 +41,7 @@ Gem::Specification.new do |spec|
41
41
  spec.add_dependency 'activesupport', '>= 4'
42
42
  spec.add_dependency 'hiera', '~> 3.3'
43
43
  spec.add_dependency 'shikashi', '~> 0.6'
44
+ spec.add_dependency 'vault', '~> 0.17'
44
45
 
45
46
  spec.add_development_dependency 'bundler'
46
47
  spec.add_development_dependency 'gem-release'
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Confidante
4
- VERSION = '0.28.0.pre.12'
4
+ VERSION = '0.28.0.pre.15'
5
5
  end
data/lib/confidante.rb CHANGED
@@ -8,6 +8,7 @@ require_relative 'shikashi_extensions/sandbox'
8
8
 
9
9
  require_relative 'hiera/backend/env_backend'
10
10
  require_relative 'hiera/backend/overrides_backend'
11
+ require_relative 'hiera/backend/vault_backend'
11
12
 
12
13
  module Confidante
13
14
  def self.configuration(opts = {})
@@ -0,0 +1,43 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'hiera'
4
+ require 'vault'
5
+
6
+ class Hiera
7
+ module Backend
8
+ # rubocop:disable Naming/ClassAndModuleCamelCase
9
+ class Vault_backend
10
+ def initialize
11
+ Hiera.debug('Hiera vault backend starting')
12
+ end
13
+
14
+ def lookup(key, scope, _order_override, resolution_type, _context)
15
+ Hiera.debug("Looking up #{key} in vault backend " \
16
+ "with #{resolution_type}")
17
+
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
+
22
+ source = vault_config[:sources][0]
23
+
24
+ throw(:unsupported_secrets_engine) unless source[:engine] == 'kv'
25
+
26
+ value = read_kv_value(vault_client, source, key)
27
+
28
+ Backend.parse_answer(value, scope)
29
+ end
30
+
31
+ def read_kv_value(vault_client, source, key)
32
+ secret = vault_client.kv(source[:mount]).read(key)
33
+ throw(:no_such_key) unless secret
34
+
35
+ value = secret.data[:value]
36
+ throw(:no_such_key) unless value
37
+ value
38
+ end
39
+ end
40
+
41
+ # rubocop:enable Naming/ClassAndModuleCamelCase
42
+ end
43
+ 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.12
4
+ version: 0.28.0.pre.15
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-03-24 00:00:00.000000000 Z
11
+ date: 2022-08-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -52,6 +52,20 @@ dependencies:
52
52
  - - "~>"
53
53
  - !ruby/object:Gem::Version
54
54
  version: '0.6'
55
+ - !ruby/object:Gem::Dependency
56
+ name: vault
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: '0.17'
62
+ type: :runtime
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: '0.17'
55
69
  - !ruby/object:Gem::Dependency
56
70
  name: bundler
57
71
  requirement: !ruby/object:Gem::Requirement
@@ -244,6 +258,7 @@ files:
244
258
  - lib/confidante/version.rb
245
259
  - lib/hiera/backend/env_backend.rb
246
260
  - lib/hiera/backend/overrides_backend.rb
261
+ - lib/hiera/backend/vault_backend.rb
247
262
  - lib/shikashi_extensions/sandbox.rb
248
263
  homepage: https://github.com/infrablocks/confidante
249
264
  licenses: