confidante 0.23.0 → 0.28.0.pre.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile +2 -0
- data/Gemfile.lock +91 -52
- data/README.md +1 -1
- data/Rakefile +65 -41
- data/bin/console +1 -0
- data/confidante.gemspec +32 -17
- data/lib/confidante.rb +2 -0
- data/lib/confidante/configuration.rb +44 -30
- data/lib/confidante/converters.rb +3 -1
- data/lib/confidante/converters/evaluating_converter.rb +3 -1
- data/lib/confidante/version.rb +3 -1
- data/lib/hiera/backend/env_backend.rb +11 -5
- data/lib/hiera/backend/overrides_backend.rb +8 -3
- data/lib/shikashi_extensions/sandbox.rb +2 -0
- metadata +113 -51
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ddf71c91ed1b06c249775c70b3afc46e24d54fc53a93e7f6c4318cab8ff58b57
|
4
|
+
data.tar.gz: d27e57dc1223f786f38ac060eb25f480fb4652f493d0e1028bc52c5c11410059
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: cc459b76cbe6d0d45bb66cbfb2e5e731926de7e0ced891fdae152e05a9409264497c3aac2c25ffb176aa5c160a7ac849f7b927bbf93e422c25cdbdcdc6c25c43
|
7
|
+
data.tar.gz: 582ecbc42d975cfd80e0ae11383251d1a78896fb67f7d045d6281dd6d3f22476b644353673ef51ab4475a1af49d38d3e736e8dd5a607c3a868b89e1108386657
|
data/Gemfile
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,118 +1,157 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
confidante (0.
|
4
|
+
confidante (0.28.0.pre.1)
|
5
5
|
activesupport (>= 4)
|
6
|
-
hiera (
|
7
|
-
shikashi (
|
6
|
+
hiera (>= 3.3, < 4)
|
7
|
+
shikashi (>= 0.6, < 1)
|
8
8
|
|
9
9
|
GEM
|
10
10
|
remote: https://rubygems.org/
|
11
11
|
specs:
|
12
|
-
activesupport (6.
|
12
|
+
activesupport (6.1.3.1)
|
13
13
|
concurrent-ruby (~> 1.0, >= 1.0.2)
|
14
|
-
i18n (>=
|
15
|
-
minitest (
|
16
|
-
tzinfo (~>
|
17
|
-
zeitwerk (~> 2.
|
14
|
+
i18n (>= 1.6, < 2)
|
15
|
+
minitest (>= 5.1)
|
16
|
+
tzinfo (~> 2.0)
|
17
|
+
zeitwerk (~> 2.3)
|
18
18
|
addressable (2.7.0)
|
19
19
|
public_suffix (>= 2.0.2, < 5.0)
|
20
|
+
ast (2.4.2)
|
20
21
|
colored2 (3.1.2)
|
21
|
-
concurrent-ruby (1.1.
|
22
|
-
diff-lcs (1.
|
22
|
+
concurrent-ruby (1.1.8)
|
23
|
+
diff-lcs (1.4.4)
|
24
|
+
docile (1.3.5)
|
23
25
|
evalhook (0.6.0)
|
24
26
|
partialruby (~> 0.3)
|
25
27
|
sexp_processor (~> 4.0)
|
26
|
-
excon (0.
|
27
|
-
faraday (1.0
|
28
|
+
excon (0.79.0)
|
29
|
+
faraday (1.3.0)
|
30
|
+
faraday-net_http (~> 1.0)
|
28
31
|
multipart-post (>= 1.2, < 3)
|
29
|
-
|
32
|
+
ruby2_keywords
|
33
|
+
faraday-net_http (1.0.1)
|
34
|
+
gem-release (2.2.1)
|
30
35
|
getsource (0.2.2)
|
31
36
|
hamster (3.0.0)
|
32
37
|
concurrent-ruby (~> 1.0)
|
33
|
-
hiera (3.
|
34
|
-
i18n (1.8.
|
38
|
+
hiera (3.7.0)
|
39
|
+
i18n (1.8.10)
|
35
40
|
concurrent-ruby (~> 1.0)
|
36
|
-
lino (1.
|
41
|
+
lino (1.9.0)
|
37
42
|
hamster (~> 3.0)
|
38
43
|
open4 (~> 1.3)
|
39
|
-
minitest (5.14.
|
44
|
+
minitest (5.14.4)
|
40
45
|
multipart-post (2.1.1)
|
41
|
-
octokit (4.
|
46
|
+
octokit (4.20.0)
|
42
47
|
faraday (>= 0.9)
|
43
48
|
sawyer (~> 0.8.0, >= 0.5.3)
|
44
49
|
open4 (1.3.4)
|
50
|
+
parallel (1.20.1)
|
51
|
+
parser (3.0.0.0)
|
52
|
+
ast (~> 2.4.1)
|
45
53
|
partialruby (0.3.0)
|
46
54
|
ruby2ruby (~> 2)
|
47
55
|
ruby_parser (~> 3)
|
48
|
-
public_suffix (4.0.
|
49
|
-
|
50
|
-
|
56
|
+
public_suffix (4.0.6)
|
57
|
+
rainbow (3.0.0)
|
58
|
+
rake (13.0.3)
|
59
|
+
rake_circle_ci (0.9.0)
|
51
60
|
colored2 (~> 3.1)
|
52
61
|
excon (~> 0.72)
|
53
62
|
rake_factory (~> 0.23)
|
54
63
|
sshkey (~> 2.0)
|
55
|
-
rake_factory (0.
|
64
|
+
rake_factory (0.29.0)
|
56
65
|
activesupport (>= 4)
|
57
66
|
rake (~> 13.0)
|
58
|
-
rake_github (0.
|
67
|
+
rake_github (0.7.0)
|
59
68
|
colored2 (~> 3.1)
|
60
69
|
octokit (~> 4.16)
|
61
70
|
rake_factory (~> 0.23)
|
62
71
|
sshkey (~> 2.0)
|
63
|
-
rake_gpg (0.
|
72
|
+
rake_gpg (0.14.0)
|
64
73
|
rake_factory (>= 0.23, < 1)
|
65
74
|
ruby_gpg2 (>= 0.6, < 1)
|
66
|
-
rake_ssh (0.
|
75
|
+
rake_ssh (0.6.0)
|
67
76
|
colored2 (~> 3.1)
|
68
77
|
rake_factory (~> 0.23)
|
69
78
|
sshkey (~> 2.0)
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
rspec-
|
74
|
-
|
75
|
-
rspec-
|
76
|
-
rspec-
|
79
|
+
regexp_parser (2.1.1)
|
80
|
+
rexml (3.2.4)
|
81
|
+
rspec (3.10.0)
|
82
|
+
rspec-core (~> 3.10.0)
|
83
|
+
rspec-expectations (~> 3.10.0)
|
84
|
+
rspec-mocks (~> 3.10.0)
|
85
|
+
rspec-core (3.10.1)
|
86
|
+
rspec-support (~> 3.10.0)
|
87
|
+
rspec-expectations (3.10.1)
|
77
88
|
diff-lcs (>= 1.2.0, < 2.0)
|
78
|
-
rspec-support (~> 3.
|
79
|
-
rspec-mocks (3.
|
89
|
+
rspec-support (~> 3.10.0)
|
90
|
+
rspec-mocks (3.10.2)
|
80
91
|
diff-lcs (>= 1.2.0, < 2.0)
|
81
|
-
rspec-support (~> 3.
|
82
|
-
rspec-support (3.
|
92
|
+
rspec-support (~> 3.10.0)
|
93
|
+
rspec-support (3.10.2)
|
94
|
+
rubocop (1.12.0)
|
95
|
+
parallel (~> 1.10)
|
96
|
+
parser (>= 3.0.0.0)
|
97
|
+
rainbow (>= 2.2.2, < 4.0)
|
98
|
+
regexp_parser (>= 1.8, < 3.0)
|
99
|
+
rexml
|
100
|
+
rubocop-ast (>= 1.2.0, < 2.0)
|
101
|
+
ruby-progressbar (~> 1.7)
|
102
|
+
unicode-display_width (>= 1.4.0, < 3.0)
|
103
|
+
rubocop-ast (1.4.1)
|
104
|
+
parser (>= 2.7.1.5)
|
105
|
+
rubocop-rake (0.5.1)
|
106
|
+
rubocop
|
107
|
+
rubocop-rspec (2.2.0)
|
108
|
+
rubocop (~> 1.0)
|
109
|
+
rubocop-ast (>= 1.1.0)
|
110
|
+
ruby-progressbar (1.11.0)
|
111
|
+
ruby2_keywords (0.0.4)
|
83
112
|
ruby2ruby (2.4.4)
|
84
113
|
ruby_parser (~> 3.1)
|
85
114
|
sexp_processor (~> 4.6)
|
86
|
-
ruby_gpg2 (0.
|
115
|
+
ruby_gpg2 (0.8.0)
|
87
116
|
lino (>= 1.5)
|
88
|
-
ruby_parser (3.
|
117
|
+
ruby_parser (3.15.1)
|
89
118
|
sexp_processor (~> 4.9)
|
90
119
|
sawyer (0.8.2)
|
91
120
|
addressable (>= 2.3.5)
|
92
121
|
faraday (> 0.8, < 2.0)
|
93
|
-
sexp_processor (4.
|
122
|
+
sexp_processor (4.15.2)
|
94
123
|
shikashi (0.6.0)
|
95
124
|
evalhook (>= 0.6.0)
|
96
125
|
getsource (>= 0.1.0)
|
126
|
+
simplecov (0.21.2)
|
127
|
+
docile (~> 1.1)
|
128
|
+
simplecov-html (~> 0.11)
|
129
|
+
simplecov_json_formatter (~> 0.1)
|
130
|
+
simplecov-html (0.12.3)
|
131
|
+
simplecov_json_formatter (0.1.2)
|
97
132
|
sshkey (2.0.0)
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
zeitwerk (2.
|
133
|
+
tzinfo (2.0.4)
|
134
|
+
concurrent-ruby (~> 1.0)
|
135
|
+
unicode-display_width (2.0.0)
|
136
|
+
zeitwerk (2.4.2)
|
102
137
|
|
103
138
|
PLATFORMS
|
104
139
|
ruby
|
105
140
|
|
106
141
|
DEPENDENCIES
|
107
|
-
bundler
|
142
|
+
bundler
|
108
143
|
confidante!
|
109
|
-
gem-release
|
110
|
-
rake
|
111
|
-
rake_circle_ci
|
112
|
-
rake_github
|
113
|
-
rake_gpg
|
114
|
-
rake_ssh
|
115
|
-
rspec
|
144
|
+
gem-release
|
145
|
+
rake
|
146
|
+
rake_circle_ci
|
147
|
+
rake_github
|
148
|
+
rake_gpg
|
149
|
+
rake_ssh
|
150
|
+
rspec
|
151
|
+
rubocop
|
152
|
+
rubocop-rake
|
153
|
+
rubocop-rspec
|
154
|
+
simplecov
|
116
155
|
|
117
156
|
BUNDLED WITH
|
118
|
-
2.2.
|
157
|
+
2.2.15
|
data/README.md
CHANGED
@@ -71,7 +71,7 @@ openssl aes-256-cbc \
|
|
71
71
|
## Contributing
|
72
72
|
|
73
73
|
Bug reports and pull requests are welcome on GitHub at
|
74
|
-
https://github.com/
|
74
|
+
https://github.com/infrablocks/confidante. This project is intended to be a
|
75
75
|
safe, welcoming space for collaboration, and contributors are expected to adhere
|
76
76
|
to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
|
77
77
|
|
data/Rakefile
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require 'yaml'
|
2
4
|
require 'rake_circle_ci'
|
3
5
|
require 'rake_github'
|
@@ -5,13 +7,16 @@ require 'rake_ssh'
|
|
5
7
|
require 'rake_gpg'
|
6
8
|
require 'securerandom'
|
7
9
|
require 'rspec/core/rake_task'
|
10
|
+
require 'rubocop/rake_task'
|
8
11
|
|
9
|
-
task :
|
10
|
-
|
11
|
-
|
12
|
+
task default: %i[
|
13
|
+
library:fix
|
14
|
+
test:unit
|
15
|
+
]
|
12
16
|
|
13
17
|
namespace :encryption do
|
14
18
|
namespace :passphrase do
|
19
|
+
desc 'Generate encryption passphrase for CI GPG key'
|
15
20
|
task :generate do
|
16
21
|
File.open('config/secrets/ci/encryption.passphrase', 'w') do |f|
|
17
22
|
f.write(SecureRandom.base64(36))
|
@@ -23,81 +28,100 @@ end
|
|
23
28
|
namespace :keys do
|
24
29
|
namespace :deploy do
|
25
30
|
RakeSSH.define_key_tasks(
|
26
|
-
|
27
|
-
|
31
|
+
path: 'config/secrets/ci/',
|
32
|
+
comment: 'maintainers@infrablocks.io'
|
33
|
+
)
|
28
34
|
end
|
29
35
|
|
30
36
|
namespace :gpg do
|
31
37
|
RakeGPG.define_generate_key_task(
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
38
|
+
output_directory: 'config/secrets/ci',
|
39
|
+
name_prefix: 'gpg',
|
40
|
+
owner_name: 'InfraBlocks Maintainers',
|
41
|
+
owner_email: 'maintainers@infrablocks.io',
|
42
|
+
owner_comment: 'confidante CI Key'
|
43
|
+
)
|
37
44
|
end
|
38
45
|
end
|
39
46
|
|
47
|
+
RuboCop::RakeTask.new
|
48
|
+
|
49
|
+
namespace :library do
|
50
|
+
desc 'Run all checks of the library'
|
51
|
+
task check: [:rubocop]
|
52
|
+
|
53
|
+
desc 'Attempt to automatically fix issues with the library'
|
54
|
+
task fix: [:'rubocop:auto_correct']
|
55
|
+
end
|
56
|
+
|
57
|
+
namespace :test do
|
58
|
+
RSpec::Core::RakeTask.new(:unit)
|
59
|
+
end
|
60
|
+
|
40
61
|
RakeCircleCI.define_project_tasks(
|
41
|
-
|
42
|
-
|
62
|
+
namespace: :circle_ci,
|
63
|
+
project_slug: 'github/infrablocks/confidante'
|
43
64
|
) do |t|
|
44
65
|
circle_ci_config =
|
45
|
-
|
66
|
+
YAML.load_file('config/secrets/circle_ci/config.yaml')
|
46
67
|
|
47
|
-
t.api_token = circle_ci_config[
|
68
|
+
t.api_token = circle_ci_config['circle_ci_api_token']
|
48
69
|
t.environment_variables = {
|
49
|
-
|
50
|
-
|
51
|
-
|
70
|
+
ENCRYPTION_PASSPHRASE:
|
71
|
+
File.read('config/secrets/ci/encryption.passphrase')
|
72
|
+
.chomp
|
52
73
|
}
|
74
|
+
t.checkout_keys = []
|
53
75
|
t.ssh_keys = [
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
76
|
+
{
|
77
|
+
hostname: 'github.com',
|
78
|
+
private_key: File.read('config/secrets/ci/ssh.private')
|
79
|
+
}
|
58
80
|
]
|
59
81
|
end
|
60
82
|
|
61
83
|
RakeGithub.define_repository_tasks(
|
62
|
-
|
63
|
-
|
84
|
+
namespace: :github,
|
85
|
+
repository: 'infrablocks/confidante'
|
64
86
|
) do |t|
|
65
87
|
github_config =
|
66
|
-
|
88
|
+
YAML.load_file('config/secrets/github/config.yaml')
|
67
89
|
|
68
|
-
t.access_token = github_config[
|
90
|
+
t.access_token = github_config['github_personal_access_token']
|
69
91
|
t.deploy_keys = [
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
92
|
+
{
|
93
|
+
title: 'CircleCI',
|
94
|
+
public_key: File.read('config/secrets/ci/ssh.public')
|
95
|
+
}
|
74
96
|
]
|
75
97
|
end
|
76
98
|
|
77
99
|
namespace :pipeline do
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
100
|
+
desc 'Prepare CircleCI Pipeline'
|
101
|
+
task prepare: %i[
|
102
|
+
circle_ci:project:follow
|
103
|
+
circle_ci:env_vars:ensure
|
104
|
+
circle_ci:checkout_keys:ensure
|
105
|
+
circle_ci:ssh_keys:ensure
|
106
|
+
github:deploy_keys:ensure
|
83
107
|
]
|
84
108
|
end
|
85
109
|
|
86
110
|
namespace :version do
|
87
|
-
desc
|
111
|
+
desc 'Bump version for specified type (pre, major, minor, patch)'
|
88
112
|
task :bump, [:type] do |_, args|
|
89
113
|
bump_version_for(args.type)
|
90
114
|
end
|
91
115
|
end
|
92
116
|
|
93
|
-
desc
|
117
|
+
desc 'Release gem'
|
94
118
|
task :release do
|
95
|
-
sh
|
119
|
+
sh 'gem release --tag --push'
|
96
120
|
end
|
97
121
|
|
98
122
|
def bump_version_for(version_type)
|
99
|
-
sh "gem bump --version #{version_type} "
|
100
|
-
|
101
|
-
|
102
|
-
|
123
|
+
sh "gem bump --version #{version_type} " \
|
124
|
+
'&& bundle install ' \
|
125
|
+
'&& export LAST_MESSAGE="$(git log -1 --pretty=%B)" ' \
|
126
|
+
'&& git commit -a --amend -m "${LAST_MESSAGE} [ci skip]"'
|
103
127
|
end
|
data/bin/console
CHANGED
data/confidante.gemspec
CHANGED
@@ -1,25 +1,36 @@
|
|
1
|
-
#
|
2
|
-
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
lib = File.expand_path('lib', __dir__)
|
3
4
|
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
5
|
require 'confidante/version'
|
5
6
|
require 'date'
|
6
7
|
|
8
|
+
files = %w[
|
9
|
+
bin
|
10
|
+
lib
|
11
|
+
CODE_OF_CONDUCT.md
|
12
|
+
confidante.gemspec
|
13
|
+
Gemfile
|
14
|
+
LICENSE.txt
|
15
|
+
Rakefile
|
16
|
+
README.md
|
17
|
+
]
|
18
|
+
|
7
19
|
Gem::Specification.new do |spec|
|
8
20
|
spec.name = 'confidante'
|
9
21
|
spec.version = Confidante::VERSION
|
10
22
|
spec.authors = ['Toby Clemson']
|
11
23
|
spec.email = ['tobyclemson@gmail.com']
|
12
24
|
|
13
|
-
spec.date = Date.today.to_s
|
14
25
|
spec.summary = 'A configuration engine over hiera.'
|
15
26
|
spec.description =
|
16
|
-
|
17
|
-
|
27
|
+
'A configuration engine combining environment variables, programmatic ' \
|
28
|
+
'overrides and the power of hiera.'
|
18
29
|
spec.homepage = 'https://github.com/infrablocks/confidante'
|
19
30
|
spec.license = 'MIT'
|
20
31
|
|
21
32
|
spec.files = `git ls-files -z`.split("\x0").select do |f|
|
22
|
-
f.match(
|
33
|
+
f.match(/^(#{files.map { |g| Regexp.escape(g) }.join('|')})/)
|
23
34
|
end
|
24
35
|
spec.bindir = 'exe'
|
25
36
|
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
@@ -27,16 +38,20 @@ Gem::Specification.new do |spec|
|
|
27
38
|
|
28
39
|
spec.required_ruby_version = '>= 2.6.0'
|
29
40
|
|
30
|
-
spec.add_dependency 'hiera', '~> 3.3', '>= 3.3.1'
|
31
41
|
spec.add_dependency 'activesupport', '>= 4'
|
32
|
-
spec.add_dependency '
|
33
|
-
|
34
|
-
|
35
|
-
spec.add_development_dependency '
|
36
|
-
spec.add_development_dependency '
|
37
|
-
spec.add_development_dependency '
|
38
|
-
spec.add_development_dependency '
|
39
|
-
spec.add_development_dependency '
|
40
|
-
spec.add_development_dependency '
|
41
|
-
spec.add_development_dependency '
|
42
|
+
spec.add_dependency 'hiera', '>= 3.3', '< 4'
|
43
|
+
spec.add_dependency 'shikashi', '>= 0.6', '< 1'
|
44
|
+
|
45
|
+
spec.add_development_dependency 'bundler'
|
46
|
+
spec.add_development_dependency 'gem-release'
|
47
|
+
spec.add_development_dependency 'rake'
|
48
|
+
spec.add_development_dependency 'rake_circle_ci'
|
49
|
+
spec.add_development_dependency 'rake_github'
|
50
|
+
spec.add_development_dependency 'rake_gpg'
|
51
|
+
spec.add_development_dependency 'rake_ssh'
|
52
|
+
spec.add_development_dependency 'rspec'
|
53
|
+
spec.add_development_dependency 'rubocop'
|
54
|
+
spec.add_development_dependency 'rubocop-rake'
|
55
|
+
spec.add_development_dependency 'rubocop-rspec'
|
56
|
+
spec.add_development_dependency 'simplecov'
|
42
57
|
end
|
data/lib/confidante.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require 'hiera'
|
2
4
|
require 'active_support'
|
3
5
|
require 'active_support/core_ext/hash/keys'
|
@@ -7,50 +9,62 @@ require_relative 'converters'
|
|
7
9
|
module Confidante
|
8
10
|
class Configuration
|
9
11
|
def initialize(opts = {})
|
10
|
-
options =
|
11
|
-
overrides: {},
|
12
|
-
scope: {},
|
13
|
-
}.merge(opts.to_options)
|
14
|
-
|
15
|
-
unless options[:hiera]
|
16
|
-
options[:hiera] = Hiera.new(config: 'config/hiera.yaml')
|
17
|
-
end
|
18
|
-
|
19
|
-
unless options[:converters]
|
20
|
-
options[:converters] =
|
21
|
-
[Confidante::Converters::EvaluatingConverter.new]
|
22
|
-
end
|
12
|
+
options = opts.to_options
|
23
13
|
|
24
|
-
@overrides = options[:overrides]
|
25
|
-
@scope = options[:scope]
|
26
|
-
@hiera = options[:hiera]
|
27
|
-
@converters = options[:converters]
|
14
|
+
@overrides = default_overrides(options[:overrides])
|
15
|
+
@scope = default_scope(options[:scope])
|
16
|
+
@hiera = default_hiera(options[:hiera])
|
17
|
+
@converters = default_converters(options[:converters])
|
28
18
|
end
|
29
19
|
|
30
20
|
def for_overrides(overrides)
|
31
21
|
Configuration.new(
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
22
|
+
overrides: overrides,
|
23
|
+
scope: @scope,
|
24
|
+
hiera: @hiera,
|
25
|
+
converters: @converters
|
26
|
+
)
|
36
27
|
end
|
37
28
|
|
38
29
|
def for_scope(scope)
|
39
30
|
Configuration.new(
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
31
|
+
overrides: @overrides,
|
32
|
+
scope: scope,
|
33
|
+
hiera: @hiera,
|
34
|
+
converters: @converters
|
35
|
+
)
|
44
36
|
end
|
45
37
|
|
46
|
-
def method_missing(method, *
|
38
|
+
def method_missing(method, *_args)
|
47
39
|
scope =
|
48
|
-
|
49
|
-
|
50
|
-
|
40
|
+
{ 'cwd' => Dir.pwd }
|
41
|
+
.merge(@scope.stringify_keys)
|
42
|
+
.merge({ 'overrides' => @overrides.to_h.stringify_keys })
|
51
43
|
@converters.inject(@hiera.lookup(method.to_s, nil, scope)) do |v, c|
|
52
44
|
c.convert(v)
|
53
45
|
end
|
54
46
|
end
|
47
|
+
|
48
|
+
def respond_to_missing?(_method_name, _include_private = false)
|
49
|
+
true
|
50
|
+
end
|
51
|
+
|
52
|
+
private
|
53
|
+
|
54
|
+
def default_overrides(overrides)
|
55
|
+
overrides || {}
|
56
|
+
end
|
57
|
+
|
58
|
+
def default_scope(scope)
|
59
|
+
scope || {}
|
60
|
+
end
|
61
|
+
|
62
|
+
def default_hiera(hiera)
|
63
|
+
hiera || Hiera.new(config: 'config/hiera.yaml')
|
64
|
+
end
|
65
|
+
|
66
|
+
def default_converters(converters)
|
67
|
+
converters || [Confidante::Converters::EvaluatingConverter.new]
|
68
|
+
end
|
55
69
|
end
|
56
|
-
end
|
70
|
+
end
|
data/lib/confidante/version.rb
CHANGED
@@ -1,20 +1,26 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require 'hiera'
|
2
4
|
|
3
5
|
class Hiera
|
4
6
|
module Backend
|
7
|
+
# rubocop:disable Naming/ClassAndModuleCamelCase
|
5
8
|
class Env_backend
|
6
9
|
def initialize
|
7
10
|
Hiera.debug('Hiera environment backend starting')
|
8
11
|
end
|
9
12
|
|
10
|
-
def lookup(key, scope,
|
13
|
+
def lookup(key, scope, _order_override, resolution_type, _context)
|
11
14
|
Hiera.debug(
|
12
|
-
|
15
|
+
"Looking up #{key} in environment backend with #{resolution_type}"
|
16
|
+
)
|
13
17
|
|
14
18
|
Backend.parse_answer(
|
15
|
-
|
16
|
-
|
19
|
+
ENV[key.to_s.upcase] || throw(:no_such_key),
|
20
|
+
scope
|
21
|
+
)
|
17
22
|
end
|
18
23
|
end
|
24
|
+
# rubocop:enable Naming/ClassAndModuleCamelCase
|
19
25
|
end
|
20
|
-
end
|
26
|
+
end
|
@@ -1,15 +1,19 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require 'hiera'
|
2
4
|
|
3
5
|
class Hiera
|
4
6
|
module Backend
|
7
|
+
# rubocop:disable Naming/ClassAndModuleCamelCase
|
5
8
|
class Overrides_backend
|
6
9
|
def initialize
|
7
10
|
Hiera.debug('Hiera overrides backend starting')
|
8
11
|
end
|
9
12
|
|
10
|
-
def lookup(key, scope,
|
13
|
+
def lookup(key, scope, _order_override, resolution_type, _context)
|
11
14
|
Hiera.debug(
|
12
|
-
|
15
|
+
"Looking up #{key} in overrides backend with #{resolution_type}"
|
16
|
+
)
|
13
17
|
|
14
18
|
overrides = scope && scope['overrides']
|
15
19
|
Hiera.debug("Found overrides: #{overrides}")
|
@@ -22,5 +26,6 @@ class Hiera
|
|
22
26
|
Backend.parse_answer(override || throw(:no_such_key), scope)
|
23
27
|
end
|
24
28
|
end
|
29
|
+
# rubocop:enable Naming/ClassAndModuleCamelCase
|
25
30
|
end
|
26
|
-
end
|
31
|
+
end
|
metadata
CHANGED
@@ -1,40 +1,37 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: confidante
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.28.0.pre.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Toby Clemson
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2021-04-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
|
-
name:
|
14
|
+
name: activesupport
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- - "~>"
|
18
|
-
- !ruby/object:Gem::Version
|
19
|
-
version: '3.3'
|
20
17
|
- - ">="
|
21
18
|
- !ruby/object:Gem::Version
|
22
|
-
version:
|
19
|
+
version: '4'
|
23
20
|
type: :runtime
|
24
21
|
prerelease: false
|
25
22
|
version_requirements: !ruby/object:Gem::Requirement
|
26
23
|
requirements:
|
27
|
-
- - "~>"
|
28
|
-
- !ruby/object:Gem::Version
|
29
|
-
version: '3.3'
|
30
24
|
- - ">="
|
31
25
|
- !ruby/object:Gem::Version
|
32
|
-
version:
|
26
|
+
version: '4'
|
33
27
|
- !ruby/object:Gem::Dependency
|
34
|
-
name:
|
28
|
+
name: hiera
|
35
29
|
requirement: !ruby/object:Gem::Requirement
|
36
30
|
requirements:
|
37
31
|
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '3.3'
|
34
|
+
- - "<"
|
38
35
|
- !ruby/object:Gem::Version
|
39
36
|
version: '4'
|
40
37
|
type: :runtime
|
@@ -42,134 +39,199 @@ dependencies:
|
|
42
39
|
version_requirements: !ruby/object:Gem::Requirement
|
43
40
|
requirements:
|
44
41
|
- - ">="
|
42
|
+
- !ruby/object:Gem::Version
|
43
|
+
version: '3.3'
|
44
|
+
- - "<"
|
45
45
|
- !ruby/object:Gem::Version
|
46
46
|
version: '4'
|
47
47
|
- !ruby/object:Gem::Dependency
|
48
48
|
name: shikashi
|
49
49
|
requirement: !ruby/object:Gem::Requirement
|
50
50
|
requirements:
|
51
|
-
- - "
|
51
|
+
- - ">="
|
52
52
|
- !ruby/object:Gem::Version
|
53
53
|
version: '0.6'
|
54
|
+
- - "<"
|
55
|
+
- !ruby/object:Gem::Version
|
56
|
+
version: '1'
|
54
57
|
type: :runtime
|
55
58
|
prerelease: false
|
56
59
|
version_requirements: !ruby/object:Gem::Requirement
|
57
60
|
requirements:
|
58
|
-
- - "
|
61
|
+
- - ">="
|
59
62
|
- !ruby/object:Gem::Version
|
60
63
|
version: '0.6'
|
64
|
+
- - "<"
|
65
|
+
- !ruby/object:Gem::Version
|
66
|
+
version: '1'
|
61
67
|
- !ruby/object:Gem::Dependency
|
62
68
|
name: bundler
|
63
69
|
requirement: !ruby/object:Gem::Requirement
|
64
70
|
requirements:
|
65
|
-
- - "
|
71
|
+
- - ">="
|
66
72
|
- !ruby/object:Gem::Version
|
67
|
-
version: '
|
73
|
+
version: '0'
|
68
74
|
type: :development
|
69
75
|
prerelease: false
|
70
76
|
version_requirements: !ruby/object:Gem::Requirement
|
71
77
|
requirements:
|
72
|
-
- - "
|
78
|
+
- - ">="
|
73
79
|
- !ruby/object:Gem::Version
|
74
|
-
version: '
|
80
|
+
version: '0'
|
81
|
+
- !ruby/object:Gem::Dependency
|
82
|
+
name: gem-release
|
83
|
+
requirement: !ruby/object:Gem::Requirement
|
84
|
+
requirements:
|
85
|
+
- - ">="
|
86
|
+
- !ruby/object:Gem::Version
|
87
|
+
version: '0'
|
88
|
+
type: :development
|
89
|
+
prerelease: false
|
90
|
+
version_requirements: !ruby/object:Gem::Requirement
|
91
|
+
requirements:
|
92
|
+
- - ">="
|
93
|
+
- !ruby/object:Gem::Version
|
94
|
+
version: '0'
|
75
95
|
- !ruby/object:Gem::Dependency
|
76
96
|
name: rake
|
77
97
|
requirement: !ruby/object:Gem::Requirement
|
78
98
|
requirements:
|
79
|
-
- - "
|
99
|
+
- - ">="
|
80
100
|
- !ruby/object:Gem::Version
|
81
|
-
version: '
|
101
|
+
version: '0'
|
82
102
|
type: :development
|
83
103
|
prerelease: false
|
84
104
|
version_requirements: !ruby/object:Gem::Requirement
|
85
105
|
requirements:
|
86
|
-
- - "
|
106
|
+
- - ">="
|
87
107
|
- !ruby/object:Gem::Version
|
88
|
-
version: '
|
108
|
+
version: '0'
|
89
109
|
- !ruby/object:Gem::Dependency
|
90
110
|
name: rake_circle_ci
|
91
111
|
requirement: !ruby/object:Gem::Requirement
|
92
112
|
requirements:
|
93
|
-
- - "
|
113
|
+
- - ">="
|
94
114
|
- !ruby/object:Gem::Version
|
95
|
-
version: '0
|
115
|
+
version: '0'
|
96
116
|
type: :development
|
97
117
|
prerelease: false
|
98
118
|
version_requirements: !ruby/object:Gem::Requirement
|
99
119
|
requirements:
|
100
|
-
- - "
|
120
|
+
- - ">="
|
101
121
|
- !ruby/object:Gem::Version
|
102
|
-
version: '0
|
122
|
+
version: '0'
|
103
123
|
- !ruby/object:Gem::Dependency
|
104
124
|
name: rake_github
|
105
125
|
requirement: !ruby/object:Gem::Requirement
|
106
126
|
requirements:
|
107
|
-
- - "
|
127
|
+
- - ">="
|
108
128
|
- !ruby/object:Gem::Version
|
109
|
-
version: '0
|
129
|
+
version: '0'
|
110
130
|
type: :development
|
111
131
|
prerelease: false
|
112
132
|
version_requirements: !ruby/object:Gem::Requirement
|
113
133
|
requirements:
|
114
|
-
- - "
|
134
|
+
- - ">="
|
115
135
|
- !ruby/object:Gem::Version
|
116
|
-
version: '0
|
136
|
+
version: '0'
|
117
137
|
- !ruby/object:Gem::Dependency
|
118
|
-
name:
|
138
|
+
name: rake_gpg
|
119
139
|
requirement: !ruby/object:Gem::Requirement
|
120
140
|
requirements:
|
121
|
-
- - "
|
141
|
+
- - ">="
|
122
142
|
- !ruby/object:Gem::Version
|
123
|
-
version: '0
|
143
|
+
version: '0'
|
124
144
|
type: :development
|
125
145
|
prerelease: false
|
126
146
|
version_requirements: !ruby/object:Gem::Requirement
|
127
147
|
requirements:
|
128
|
-
- - "
|
148
|
+
- - ">="
|
129
149
|
- !ruby/object:Gem::Version
|
130
|
-
version: '0
|
150
|
+
version: '0'
|
131
151
|
- !ruby/object:Gem::Dependency
|
132
|
-
name:
|
152
|
+
name: rake_ssh
|
133
153
|
requirement: !ruby/object:Gem::Requirement
|
134
154
|
requirements:
|
135
|
-
- - "
|
155
|
+
- - ">="
|
136
156
|
- !ruby/object:Gem::Version
|
137
|
-
version: '0
|
157
|
+
version: '0'
|
138
158
|
type: :development
|
139
159
|
prerelease: false
|
140
160
|
version_requirements: !ruby/object:Gem::Requirement
|
141
161
|
requirements:
|
142
|
-
- - "
|
162
|
+
- - ">="
|
143
163
|
- !ruby/object:Gem::Version
|
144
|
-
version: '0
|
164
|
+
version: '0'
|
145
165
|
- !ruby/object:Gem::Dependency
|
146
166
|
name: rspec
|
147
167
|
requirement: !ruby/object:Gem::Requirement
|
148
168
|
requirements:
|
149
|
-
- - "
|
169
|
+
- - ">="
|
150
170
|
- !ruby/object:Gem::Version
|
151
|
-
version: '
|
171
|
+
version: '0'
|
152
172
|
type: :development
|
153
173
|
prerelease: false
|
154
174
|
version_requirements: !ruby/object:Gem::Requirement
|
155
175
|
requirements:
|
156
|
-
- - "
|
176
|
+
- - ">="
|
157
177
|
- !ruby/object:Gem::Version
|
158
|
-
version: '
|
178
|
+
version: '0'
|
159
179
|
- !ruby/object:Gem::Dependency
|
160
|
-
name:
|
180
|
+
name: rubocop
|
181
|
+
requirement: !ruby/object:Gem::Requirement
|
182
|
+
requirements:
|
183
|
+
- - ">="
|
184
|
+
- !ruby/object:Gem::Version
|
185
|
+
version: '0'
|
186
|
+
type: :development
|
187
|
+
prerelease: false
|
188
|
+
version_requirements: !ruby/object:Gem::Requirement
|
189
|
+
requirements:
|
190
|
+
- - ">="
|
191
|
+
- !ruby/object:Gem::Version
|
192
|
+
version: '0'
|
193
|
+
- !ruby/object:Gem::Dependency
|
194
|
+
name: rubocop-rake
|
195
|
+
requirement: !ruby/object:Gem::Requirement
|
196
|
+
requirements:
|
197
|
+
- - ">="
|
198
|
+
- !ruby/object:Gem::Version
|
199
|
+
version: '0'
|
200
|
+
type: :development
|
201
|
+
prerelease: false
|
202
|
+
version_requirements: !ruby/object:Gem::Requirement
|
203
|
+
requirements:
|
204
|
+
- - ">="
|
205
|
+
- !ruby/object:Gem::Version
|
206
|
+
version: '0'
|
207
|
+
- !ruby/object:Gem::Dependency
|
208
|
+
name: rubocop-rspec
|
161
209
|
requirement: !ruby/object:Gem::Requirement
|
162
210
|
requirements:
|
163
|
-
- - "
|
211
|
+
- - ">="
|
164
212
|
- !ruby/object:Gem::Version
|
165
|
-
version: '
|
213
|
+
version: '0'
|
166
214
|
type: :development
|
167
215
|
prerelease: false
|
168
216
|
version_requirements: !ruby/object:Gem::Requirement
|
169
217
|
requirements:
|
170
|
-
- - "
|
218
|
+
- - ">="
|
171
219
|
- !ruby/object:Gem::Version
|
172
|
-
version: '
|
220
|
+
version: '0'
|
221
|
+
- !ruby/object:Gem::Dependency
|
222
|
+
name: simplecov
|
223
|
+
requirement: !ruby/object:Gem::Requirement
|
224
|
+
requirements:
|
225
|
+
- - ">="
|
226
|
+
- !ruby/object:Gem::Version
|
227
|
+
version: '0'
|
228
|
+
type: :development
|
229
|
+
prerelease: false
|
230
|
+
version_requirements: !ruby/object:Gem::Requirement
|
231
|
+
requirements:
|
232
|
+
- - ">="
|
233
|
+
- !ruby/object:Gem::Version
|
234
|
+
version: '0'
|
173
235
|
description: A configuration engine combining environment variables, programmatic
|
174
236
|
overrides and the power of hiera.
|
175
237
|
email:
|
@@ -210,9 +272,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
210
272
|
version: 2.6.0
|
211
273
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
212
274
|
requirements:
|
213
|
-
- - "
|
275
|
+
- - ">"
|
214
276
|
- !ruby/object:Gem::Version
|
215
|
-
version:
|
277
|
+
version: 1.3.1
|
216
278
|
requirements: []
|
217
279
|
rubygems_version: 3.0.1
|
218
280
|
signing_key:
|