r10k 3.9.3 → 3.10.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/rspec_tests.yml +1 -1
- data/CHANGELOG.mkd +9 -0
- data/doc/dynamic-environments/configuration.mkd +7 -0
- data/integration/Rakefile +1 -1
- data/integration/tests/user_scenario/basic_workflow/negative/neg_specify_deleted_forge_module.rb +3 -9
- data/integration/tests/user_scenario/basic_workflow/single_env_purge_unmanaged_modules.rb +8 -14
- data/lib/r10k/action/deploy/environment.rb +3 -0
- data/lib/r10k/action/runner.rb +11 -6
- data/lib/r10k/git/cache.rb +1 -1
- data/lib/r10k/initializers.rb +7 -0
- data/lib/r10k/module/forge.rb +5 -1
- data/lib/r10k/module_loader/puppetfile.rb +195 -0
- data/lib/r10k/module_loader/puppetfile/dsl.rb +37 -0
- data/lib/r10k/puppetfile.rb +77 -153
- data/lib/r10k/settings.rb +3 -0
- data/lib/r10k/source/base.rb +10 -0
- data/lib/r10k/source/git.rb +5 -0
- data/lib/r10k/source/svn.rb +4 -0
- data/lib/r10k/util/purgeable.rb +70 -8
- data/lib/r10k/version.rb +1 -1
- data/locales/r10k.pot +37 -33
- data/spec/fixtures/unit/action/r10k_forge_auth.yaml +4 -0
- data/spec/fixtures/unit/action/r10k_forge_auth_no_url.yaml +3 -0
- data/spec/fixtures/unit/util/purgeable/managed_one/managed_subdir_1/managed_subdir_2/ignored_1 +0 -0
- data/spec/fixtures/unit/util/purgeable/managed_two/.hidden/unmanaged_3 +0 -0
- data/spec/unit/action/deploy/environment_spec.rb +9 -0
- data/spec/unit/action/deploy/module_spec.rb +38 -14
- data/spec/unit/action/runner_spec.rb +49 -25
- data/spec/unit/git/cache_spec.rb +14 -0
- data/spec/unit/module/forge_spec.rb +8 -1
- data/spec/unit/module_loader/puppetfile_spec.rb +330 -0
- data/spec/unit/puppetfile_spec.rb +99 -193
- data/spec/unit/settings_spec.rb +6 -2
- data/spec/unit/util/purgeable_spec.rb +38 -6
- metadata +10 -3
data/spec/unit/settings_spec.rb
CHANGED
@@ -250,8 +250,12 @@ describe R10K::Settings do
|
|
250
250
|
|
251
251
|
describe "forge settings" do
|
252
252
|
it "passes settings through to the forge settings" do
|
253
|
-
output = subject.evaluate("forge" => {"baseurl" => "https://forge.tessier-ashpool.freeside",
|
254
|
-
|
253
|
+
output = subject.evaluate("forge" => {"baseurl" => "https://forge.tessier-ashpool.freeside",
|
254
|
+
"proxy" => "https://proxy.tessier-ashpool.freesize:3128",
|
255
|
+
"authorization_token" => "faketoken"})
|
256
|
+
expect(output[:forge]).to eq(:baseurl => "https://forge.tessier-ashpool.freeside",
|
257
|
+
:proxy => "https://proxy.tessier-ashpool.freesize:3128",
|
258
|
+
:authorization_token => "faketoken")
|
255
259
|
end
|
256
260
|
end
|
257
261
|
end
|
@@ -19,6 +19,7 @@ RSpec.describe R10K::Util::Purgeable do
|
|
19
19
|
'spec/fixtures/unit/util/purgeable/managed_one/managed_subdir_1/subdir_new_1',
|
20
20
|
'spec/fixtures/unit/util/purgeable/managed_two/expected_2',
|
21
21
|
'spec/fixtures/unit/util/purgeable/managed_two/new_2',
|
22
|
+
'spec/fixtures/unit/util/purgeable/managed_two/.hidden',
|
22
23
|
]
|
23
24
|
end
|
24
25
|
|
@@ -98,7 +99,13 @@ RSpec.describe R10K::Util::Purgeable do
|
|
98
99
|
|
99
100
|
describe '#current_contents' do
|
100
101
|
it 'collects contents of all managed directories recursively' do
|
101
|
-
expect(subject.current_contents(recurse)).
|
102
|
+
expect(subject.current_contents(recurse)).
|
103
|
+
to contain_exactly(/\/expected_1/, /\/expected_2/,
|
104
|
+
/\/unmanaged_1/, /\/unmanaged_2/,
|
105
|
+
/\/managed_subdir_1/,
|
106
|
+
/\/subdir_expected_1/, /\/subdir_unmanaged_1/,
|
107
|
+
/\/managed_subdir_2/, /\/ignored_1/,
|
108
|
+
/\/\.hidden/)
|
102
109
|
end
|
103
110
|
end
|
104
111
|
|
@@ -114,7 +121,8 @@ RSpec.describe R10K::Util::Purgeable do
|
|
114
121
|
let(:whitelist) { [] }
|
115
122
|
|
116
123
|
it 'collects current_contents that should not exist recursively' do
|
117
|
-
expect(subject.stale_contents(recurse, exclusions, whitelist)).
|
124
|
+
expect(subject.stale_contents(recurse, exclusions, whitelist)).
|
125
|
+
to contain_exactly(/\/unmanaged_1/, /\/unmanaged_2/, /\/subdir_unmanaged_1/, /\/ignored_1/)
|
118
126
|
end
|
119
127
|
end
|
120
128
|
|
@@ -124,7 +132,17 @@ RSpec.describe R10K::Util::Purgeable do
|
|
124
132
|
|
125
133
|
it 'collects current_contents that should not exist except whitelisted items' do
|
126
134
|
expect(subject.logger).to receive(:debug).with(/unmanaged_1.*whitelist match/i)
|
127
|
-
|
135
|
+
|
136
|
+
expect(subject.stale_contents(recurse, exclusions, whitelist)).
|
137
|
+
to contain_exactly(/\/unmanaged_2/, /\/subdir_unmanaged_1/, /\/ignored_1/)
|
138
|
+
end
|
139
|
+
|
140
|
+
it 'does not collect contents that match recursive globbed whitelist items as intermediate values' do
|
141
|
+
recursive_whitelist = ['**/managed_subdir_1/**/*']
|
142
|
+
expect(subject.logger).not_to receive(:debug).with(/ignored_1/)
|
143
|
+
|
144
|
+
expect(subject.stale_contents(recurse, exclusions, recursive_whitelist)).
|
145
|
+
to contain_exactly(/\/unmanaged_2/, /\/managed_one\/unmanaged_1/)
|
128
146
|
end
|
129
147
|
end
|
130
148
|
|
@@ -134,7 +152,17 @@ RSpec.describe R10K::Util::Purgeable do
|
|
134
152
|
|
135
153
|
it 'collects current_contents that should not exist except excluded items' do
|
136
154
|
expect(subject.logger).to receive(:debug2).with(/unmanaged_2.*internal exclusion match/i)
|
137
|
-
|
155
|
+
|
156
|
+
expect(subject.stale_contents(recurse, exclusions, whitelist)).
|
157
|
+
to contain_exactly(/\/unmanaged_1/, /\/subdir_unmanaged_1/, /\/ignored_1/)
|
158
|
+
end
|
159
|
+
|
160
|
+
it 'does not collect contents that match recursive globbed exclusion items as intermediate values' do
|
161
|
+
recursive_exclusions = ['**/managed_subdir_1/**/*']
|
162
|
+
expect(subject.logger).not_to receive(:debug).with(/ignored_1/)
|
163
|
+
|
164
|
+
expect(subject.stale_contents(recurse, recursive_exclusions, whitelist)).
|
165
|
+
to contain_exactly(/\/unmanaged_2/, /\/managed_one\/unmanaged_1/)
|
138
166
|
end
|
139
167
|
end
|
140
168
|
end
|
@@ -179,7 +207,11 @@ RSpec.describe R10K::Util::Purgeable do
|
|
179
207
|
end
|
180
208
|
|
181
209
|
context "recursive whitelist glob" do
|
182
|
-
let(:whitelist)
|
210
|
+
let(:whitelist) do
|
211
|
+
managed_directories.flat_map do |dir|
|
212
|
+
[File.join(dir, "**", "*unmanaged*"), File.join(dir, "**", "managed_subdir_2")]
|
213
|
+
end
|
214
|
+
end
|
183
215
|
let(:purge_opts) { { recurse: true, whitelist: whitelist } }
|
184
216
|
|
185
217
|
describe '#purge!' do
|
@@ -214,7 +246,7 @@ RSpec.describe R10K::Util::Purgeable do
|
|
214
246
|
context "when class does not implement #purge_exclusions" do
|
215
247
|
describe '#purge!' do
|
216
248
|
it 'purges normally' do
|
217
|
-
expect(FileUtils).to receive(:rm_r).at_least(
|
249
|
+
expect(FileUtils).to receive(:rm_r).at_least(4).times
|
218
250
|
|
219
251
|
subject.purge!(purge_opts)
|
220
252
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: r10k
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.
|
4
|
+
version: 3.10.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Adrien Thebo
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-
|
11
|
+
date: 2021-07-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: colored2
|
@@ -393,6 +393,8 @@ files:
|
|
393
393
|
- lib/r10k/module/local.rb
|
394
394
|
- lib/r10k/module/metadata_file.rb
|
395
395
|
- lib/r10k/module/svn.rb
|
396
|
+
- lib/r10k/module_loader/puppetfile.rb
|
397
|
+
- lib/r10k/module_loader/puppetfile/dsl.rb
|
396
398
|
- lib/r10k/puppetfile.rb
|
397
399
|
- lib/r10k/settings.rb
|
398
400
|
- lib/r10k/settings/collection.rb
|
@@ -446,6 +448,8 @@ files:
|
|
446
448
|
- spec/fixtures/unit/action/r10k.yaml
|
447
449
|
- spec/fixtures/unit/action/r10k_cachedir.yaml
|
448
450
|
- spec/fixtures/unit/action/r10k_creds.yaml
|
451
|
+
- spec/fixtures/unit/action/r10k_forge_auth.yaml
|
452
|
+
- spec/fixtures/unit/action/r10k_forge_auth_no_url.yaml
|
449
453
|
- spec/fixtures/unit/action/r10k_generate_types.yaml
|
450
454
|
- spec/fixtures/unit/action/r10k_puppet_path.yaml
|
451
455
|
- spec/fixtures/unit/puppetfile/argument-error/Puppetfile
|
@@ -457,9 +461,11 @@ files:
|
|
457
461
|
- spec/fixtures/unit/puppetfile/valid-forge-with-version/Puppetfile
|
458
462
|
- spec/fixtures/unit/puppetfile/valid-forge-without-version/Puppetfile
|
459
463
|
- spec/fixtures/unit/util/purgeable/managed_one/expected_1
|
464
|
+
- spec/fixtures/unit/util/purgeable/managed_one/managed_subdir_1/managed_subdir_2/ignored_1
|
460
465
|
- spec/fixtures/unit/util/purgeable/managed_one/managed_subdir_1/subdir_expected_1
|
461
466
|
- spec/fixtures/unit/util/purgeable/managed_one/managed_subdir_1/subdir_unmanaged_1
|
462
467
|
- spec/fixtures/unit/util/purgeable/managed_one/unmanaged_1
|
468
|
+
- spec/fixtures/unit/util/purgeable/managed_two/.hidden/unmanaged_3
|
463
469
|
- spec/fixtures/unit/util/purgeable/managed_two/expected_2
|
464
470
|
- spec/fixtures/unit/util/purgeable/managed_two/unmanaged_2
|
465
471
|
- spec/fixtures/unit/util/subprocess/runner/no-execute.sh
|
@@ -525,6 +531,7 @@ files:
|
|
525
531
|
- spec/unit/module/git_spec.rb
|
526
532
|
- spec/unit/module/metadata_file_spec.rb
|
527
533
|
- spec/unit/module/svn_spec.rb
|
534
|
+
- spec/unit/module_loader/puppetfile_spec.rb
|
528
535
|
- spec/unit/module_spec.rb
|
529
536
|
- spec/unit/puppetfile_spec.rb
|
530
537
|
- spec/unit/settings/collection_spec.rb
|
@@ -576,7 +583,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
576
583
|
- !ruby/object:Gem::Version
|
577
584
|
version: '0'
|
578
585
|
requirements: []
|
579
|
-
rubygems_version: 3.0.
|
586
|
+
rubygems_version: 3.0.3
|
580
587
|
signing_key:
|
581
588
|
specification_version: 4
|
582
589
|
summary: Puppet environment and module deployment
|