confidante 0.27.0 → 0.28.0.pre.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CODE_OF_CONDUCT.md +1 -1
- data/Gemfile +2 -0
- data/Gemfile.lock +79 -35
- data/Rakefile +66 -42
- data/bin/console +1 -0
- data/confidante.gemspec +34 -19
- 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 +115 -53
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 63757deac44a8dc8445094c33dfc44a018d4fae470ab1acc2c9b23afa4fa20ff
|
4
|
+
data.tar.gz: b94f2515ea47608b0b9cf02a0ce62b667d6514b67b4e2aab901a8aad80ebca69
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 74b44c879cc3016079f943646aca32a6cb1eab96ad327229dd67047d46f4ea79c3ae567a4a39a0ea1916b03748240e712d615aa6a39cad5d930e59c14ac8da27
|
7
|
+
data.tar.gz: 0c743e549dd5ef722d5e8875daa6002d9685b58316af17a7b890110fe3e783112254d09d790d22c4870b871346d728ee36698fe19fe331799604e7044ea7d769
|
data/CODE_OF_CONDUCT.md
CHANGED
@@ -55,7 +55,7 @@ further defined and clarified by project maintainers.
|
|
55
55
|
## Enforcement
|
56
56
|
|
57
57
|
Instances of abusive, harassing, or otherwise unacceptable behavior may be
|
58
|
-
reported by contacting the project team at
|
58
|
+
reported by contacting the project team at maintainers@infrablocks.io. All
|
59
59
|
complaints will be reviewed and investigated and will result in a response that
|
60
60
|
is deemed necessary and appropriate to the circumstances. The project team is
|
61
61
|
obligated to maintain confidentiality with regard to the reporter of an incident.
|
data/Gemfile
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
confidante (0.
|
4
|
+
confidante (0.28.0.pre.6)
|
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.1.
|
12
|
+
activesupport (6.1.3.2)
|
13
13
|
concurrent-ruby (~> 1.0, >= 1.0.2)
|
14
14
|
i18n (>= 1.6, < 2)
|
15
15
|
minitest (>= 5.1)
|
@@ -17,59 +17,75 @@ GEM
|
|
17
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
|
+
concurrent-ruby (1.1.8)
|
22
23
|
diff-lcs (1.4.4)
|
24
|
+
docile (1.4.0)
|
23
25
|
evalhook (0.6.0)
|
24
26
|
partialruby (~> 0.3)
|
25
27
|
sexp_processor (~> 4.0)
|
26
|
-
excon (0.
|
27
|
-
faraday (1.
|
28
|
+
excon (0.82.0)
|
29
|
+
faraday (1.4.2)
|
30
|
+
faraday-em_http (~> 1.0)
|
31
|
+
faraday-em_synchrony (~> 1.0)
|
32
|
+
faraday-excon (~> 1.1)
|
28
33
|
faraday-net_http (~> 1.0)
|
34
|
+
faraday-net_http_persistent (~> 1.1)
|
29
35
|
multipart-post (>= 1.2, < 3)
|
30
|
-
ruby2_keywords
|
31
|
-
faraday-
|
32
|
-
|
36
|
+
ruby2_keywords (>= 0.0.4)
|
37
|
+
faraday-em_http (1.0.0)
|
38
|
+
faraday-em_synchrony (1.0.0)
|
39
|
+
faraday-excon (1.1.0)
|
40
|
+
faraday-net_http (1.0.1)
|
41
|
+
faraday-net_http_persistent (1.1.0)
|
42
|
+
gem-release (2.2.1)
|
33
43
|
getsource (0.2.2)
|
34
44
|
hamster (3.0.0)
|
35
45
|
concurrent-ruby (~> 1.0)
|
36
|
-
hiera (3.
|
37
|
-
i18n (1.8.
|
46
|
+
hiera (3.7.0)
|
47
|
+
i18n (1.8.10)
|
38
48
|
concurrent-ruby (~> 1.0)
|
39
|
-
lino (
|
49
|
+
lino (3.0.0)
|
40
50
|
hamster (~> 3.0)
|
41
51
|
open4 (~> 1.3)
|
42
|
-
minitest (5.14.
|
52
|
+
minitest (5.14.4)
|
43
53
|
multipart-post (2.1.1)
|
44
|
-
octokit (4.
|
54
|
+
octokit (4.21.0)
|
45
55
|
faraday (>= 0.9)
|
46
56
|
sawyer (~> 0.8.0, >= 0.5.3)
|
47
57
|
open4 (1.3.4)
|
58
|
+
parallel (1.20.1)
|
59
|
+
parser (3.0.1.1)
|
60
|
+
ast (~> 2.4.1)
|
48
61
|
partialruby (0.3.0)
|
49
62
|
ruby2ruby (~> 2)
|
50
63
|
ruby_parser (~> 3)
|
51
64
|
public_suffix (4.0.6)
|
65
|
+
rainbow (3.0.0)
|
52
66
|
rake (13.0.3)
|
53
67
|
rake_circle_ci (0.9.0)
|
54
68
|
colored2 (~> 3.1)
|
55
69
|
excon (~> 0.72)
|
56
70
|
rake_factory (~> 0.23)
|
57
71
|
sshkey (~> 2.0)
|
58
|
-
rake_factory (0.
|
72
|
+
rake_factory (0.29.0)
|
59
73
|
activesupport (>= 4)
|
60
74
|
rake (~> 13.0)
|
61
|
-
rake_github (0.
|
75
|
+
rake_github (0.7.0)
|
62
76
|
colored2 (~> 3.1)
|
63
77
|
octokit (~> 4.16)
|
64
78
|
rake_factory (~> 0.23)
|
65
79
|
sshkey (~> 2.0)
|
66
|
-
rake_gpg (0.
|
80
|
+
rake_gpg (0.16.0)
|
67
81
|
rake_factory (>= 0.23, < 1)
|
68
82
|
ruby_gpg2 (>= 0.6, < 1)
|
69
|
-
rake_ssh (0.
|
83
|
+
rake_ssh (0.6.0)
|
70
84
|
colored2 (~> 3.1)
|
71
85
|
rake_factory (~> 0.23)
|
72
86
|
sshkey (~> 2.0)
|
87
|
+
regexp_parser (2.1.1)
|
88
|
+
rexml (3.2.5)
|
73
89
|
rspec (3.10.0)
|
74
90
|
rspec-core (~> 3.10.0)
|
75
91
|
rspec-expectations (~> 3.10.0)
|
@@ -79,43 +95,71 @@ GEM
|
|
79
95
|
rspec-expectations (3.10.1)
|
80
96
|
diff-lcs (>= 1.2.0, < 2.0)
|
81
97
|
rspec-support (~> 3.10.0)
|
82
|
-
rspec-mocks (3.10.
|
98
|
+
rspec-mocks (3.10.2)
|
83
99
|
diff-lcs (>= 1.2.0, < 2.0)
|
84
100
|
rspec-support (~> 3.10.0)
|
85
|
-
rspec-support (3.10.
|
86
|
-
|
101
|
+
rspec-support (3.10.2)
|
102
|
+
rubocop (1.15.0)
|
103
|
+
parallel (~> 1.10)
|
104
|
+
parser (>= 3.0.0.0)
|
105
|
+
rainbow (>= 2.2.2, < 4.0)
|
106
|
+
regexp_parser (>= 1.8, < 3.0)
|
107
|
+
rexml
|
108
|
+
rubocop-ast (>= 1.5.0, < 2.0)
|
109
|
+
ruby-progressbar (~> 1.7)
|
110
|
+
unicode-display_width (>= 1.4.0, < 3.0)
|
111
|
+
rubocop-ast (1.7.0)
|
112
|
+
parser (>= 3.0.1.1)
|
113
|
+
rubocop-rake (0.5.1)
|
114
|
+
rubocop
|
115
|
+
rubocop-rspec (2.3.0)
|
116
|
+
rubocop (~> 1.0)
|
117
|
+
rubocop-ast (>= 1.1.0)
|
118
|
+
ruby-progressbar (1.11.0)
|
119
|
+
ruby2_keywords (0.0.4)
|
87
120
|
ruby2ruby (2.4.4)
|
88
121
|
ruby_parser (~> 3.1)
|
89
122
|
sexp_processor (~> 4.6)
|
90
|
-
ruby_gpg2 (0.
|
123
|
+
ruby_gpg2 (0.8.0)
|
91
124
|
lino (>= 1.5)
|
92
|
-
ruby_parser (3.
|
93
|
-
sexp_processor (~> 4.
|
125
|
+
ruby_parser (3.16.0)
|
126
|
+
sexp_processor (~> 4.15, >= 4.15.1)
|
94
127
|
sawyer (0.8.2)
|
95
128
|
addressable (>= 2.3.5)
|
96
129
|
faraday (> 0.8, < 2.0)
|
97
|
-
sexp_processor (4.15.
|
130
|
+
sexp_processor (4.15.3)
|
98
131
|
shikashi (0.6.0)
|
99
132
|
evalhook (>= 0.6.0)
|
100
133
|
getsource (>= 0.1.0)
|
134
|
+
simplecov (0.21.2)
|
135
|
+
docile (~> 1.1)
|
136
|
+
simplecov-html (~> 0.11)
|
137
|
+
simplecov_json_formatter (~> 0.1)
|
138
|
+
simplecov-html (0.12.3)
|
139
|
+
simplecov_json_formatter (0.1.3)
|
101
140
|
sshkey (2.0.0)
|
102
141
|
tzinfo (2.0.4)
|
103
142
|
concurrent-ruby (~> 1.0)
|
143
|
+
unicode-display_width (2.0.0)
|
104
144
|
zeitwerk (2.4.2)
|
105
145
|
|
106
146
|
PLATFORMS
|
107
147
|
ruby
|
108
148
|
|
109
149
|
DEPENDENCIES
|
110
|
-
bundler
|
150
|
+
bundler
|
111
151
|
confidante!
|
112
|
-
gem-release
|
113
|
-
rake
|
114
|
-
rake_circle_ci
|
115
|
-
rake_github
|
116
|
-
rake_gpg
|
117
|
-
rake_ssh
|
118
|
-
rspec
|
152
|
+
gem-release
|
153
|
+
rake
|
154
|
+
rake_circle_ci
|
155
|
+
rake_github
|
156
|
+
rake_gpg
|
157
|
+
rake_ssh
|
158
|
+
rspec
|
159
|
+
rubocop
|
160
|
+
rubocop-rake
|
161
|
+
rubocop-rspec
|
162
|
+
simplecov
|
119
163
|
|
120
164
|
BUNDLED WITH
|
121
|
-
2.2.
|
165
|
+
2.2.18
|
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,83 +28,102 @@ 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
|
}
|
53
74
|
t.checkout_keys = []
|
54
75
|
t.ssh_keys = [
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
76
|
+
{
|
77
|
+
hostname: 'github.com',
|
78
|
+
private_key: File.read('config/secrets/ci/ssh.private')
|
79
|
+
}
|
59
80
|
]
|
60
81
|
end
|
61
82
|
|
62
83
|
RakeGithub.define_repository_tasks(
|
63
|
-
|
64
|
-
|
84
|
+
namespace: :github,
|
85
|
+
repository: 'infrablocks/confidante'
|
65
86
|
) do |t|
|
66
87
|
github_config =
|
67
|
-
|
88
|
+
YAML.load_file('config/secrets/github/config.yaml')
|
68
89
|
|
69
|
-
t.access_token = github_config[
|
90
|
+
t.access_token = github_config['github_personal_access_token']
|
70
91
|
t.deploy_keys = [
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
92
|
+
{
|
93
|
+
title: 'CircleCI',
|
94
|
+
public_key: File.read('config/secrets/ci/ssh.public')
|
95
|
+
}
|
75
96
|
]
|
76
97
|
end
|
77
98
|
|
78
99
|
namespace :pipeline do
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
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
|
85
107
|
]
|
86
108
|
end
|
87
109
|
|
88
110
|
namespace :version do
|
89
|
-
desc
|
111
|
+
desc 'Bump version for specified type (pre, major, minor, patch)'
|
90
112
|
task :bump, [:type] do |_, args|
|
91
113
|
bump_version_for(args.type)
|
92
114
|
end
|
93
115
|
end
|
94
116
|
|
95
|
-
desc
|
117
|
+
desc 'Release gem'
|
96
118
|
task :release do
|
97
|
-
sh
|
119
|
+
sh 'gem release --tag --push'
|
98
120
|
end
|
99
121
|
|
100
122
|
def bump_version_for(version_type)
|
101
|
-
sh
|
102
|
-
|
103
|
-
|
104
|
-
|
123
|
+
sh 'gem bump ' \
|
124
|
+
'--skip-ci ' \
|
125
|
+
"--version #{version_type} " \
|
126
|
+
'&& bundle install ' \
|
127
|
+
'&& export LAST_MESSAGE="$(git log -1 --pretty=%B)" ' \
|
128
|
+
'&& git commit -a --amend -m "${LAST_MESSAGE}"'
|
105
129
|
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
|
-
spec.authors = ['
|
11
|
-
spec.email = ['
|
22
|
+
spec.authors = ['InfraBlocks Maintainers']
|
23
|
+
spec.email = ['maintainers@infrablocks.io']
|
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.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
|
-
-
|
7
|
+
- InfraBlocks Maintainers
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-
|
11
|
+
date: 2021-05-30 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,138 +39,203 @@ 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:
|
176
|
-
-
|
238
|
+
- maintainers@infrablocks.io
|
177
239
|
executables: []
|
178
240
|
extensions: []
|
179
241
|
extra_rdoc_files: []
|
@@ -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:
|