r10k 3.9.0 → 3.10.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.github/pull_request_template.md +1 -1
- data/.github/workflows/rspec_tests.yml +1 -1
- data/.github/workflows/stale.yml +19 -0
- data/CHANGELOG.mkd +24 -0
- data/doc/dynamic-environments/configuration.mkd +13 -6
- 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/base.rb +10 -0
- data/lib/r10k/action/deploy/display.rb +42 -9
- data/lib/r10k/action/deploy/environment.rb +70 -41
- data/lib/r10k/action/deploy/module.rb +51 -29
- data/lib/r10k/action/puppetfile/check.rb +3 -1
- data/lib/r10k/action/puppetfile/install.rb +20 -23
- data/lib/r10k/action/puppetfile/purge.rb +8 -2
- data/lib/r10k/action/runner.rb +11 -6
- data/lib/r10k/content_synchronizer.rb +83 -0
- data/lib/r10k/deployment.rb +1 -1
- data/lib/r10k/environment/base.rb +21 -1
- data/lib/r10k/environment/git.rb +0 -3
- data/lib/r10k/environment/svn.rb +4 -6
- data/lib/r10k/environment/with_modules.rb +18 -10
- data/lib/r10k/git/cache.rb +1 -1
- data/lib/r10k/initializers.rb +7 -0
- data/lib/r10k/module.rb +1 -1
- data/lib/r10k/module/base.rb +17 -1
- data/lib/r10k/module/forge.rb +29 -19
- data/lib/r10k/module/git.rb +23 -14
- data/lib/r10k/module/local.rb +1 -0
- data/lib/r10k/module/svn.rb +12 -9
- data/lib/r10k/module_loader/puppetfile.rb +195 -0
- data/lib/r10k/module_loader/puppetfile/dsl.rb +37 -0
- data/lib/r10k/puppetfile.rb +111 -202
- data/lib/r10k/settings.rb +3 -0
- data/lib/r10k/source/base.rb +14 -0
- data/lib/r10k/source/git.rb +19 -6
- data/lib/r10k/source/hash.rb +1 -3
- data/lib/r10k/source/svn.rb +4 -2
- data/lib/r10k/util/cleaner.rb +21 -0
- data/lib/r10k/util/purgeable.rb +70 -8
- data/lib/r10k/version.rb +1 -1
- data/locales/r10k.pot +67 -71
- 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/r10k-mocks/mock_source.rb +1 -1
- data/spec/shared-examples/puppetfile-action.rb +7 -7
- data/spec/unit/action/deploy/display_spec.rb +32 -6
- data/spec/unit/action/deploy/environment_spec.rb +85 -48
- data/spec/unit/action/deploy/module_spec.rb +163 -31
- data/spec/unit/action/puppetfile/check_spec.rb +2 -2
- data/spec/unit/action/puppetfile/install_spec.rb +31 -10
- data/spec/unit/action/puppetfile/purge_spec.rb +25 -5
- 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 +23 -14
- data/spec/unit/module/git_spec.rb +8 -8
- data/spec/unit/module_loader/puppetfile_spec.rb +330 -0
- data/spec/unit/module_spec.rb +22 -5
- data/spec/unit/puppetfile_spec.rb +123 -203
- data/spec/unit/settings_spec.rb +6 -2
- data/spec/unit/util/purgeable_spec.rb +40 -14
- metadata +12 -2
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
|
@@ -1,5 +1,6 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
require 'r10k/util/purgeable'
|
3
|
+
require 'r10k/util/cleaner'
|
3
4
|
|
4
5
|
RSpec.describe R10K::Util::Purgeable do
|
5
6
|
let(:managed_directories) do
|
@@ -18,17 +19,11 @@ RSpec.describe R10K::Util::Purgeable do
|
|
18
19
|
'spec/fixtures/unit/util/purgeable/managed_one/managed_subdir_1/subdir_new_1',
|
19
20
|
'spec/fixtures/unit/util/purgeable/managed_two/expected_2',
|
20
21
|
'spec/fixtures/unit/util/purgeable/managed_two/new_2',
|
22
|
+
'spec/fixtures/unit/util/purgeable/managed_two/.hidden',
|
21
23
|
]
|
22
24
|
end
|
23
25
|
|
24
|
-
|
25
|
-
Struct.new(:managed_directories, :desired_contents) do
|
26
|
-
include R10K::Util::Purgeable
|
27
|
-
include R10K::Logging
|
28
|
-
end
|
29
|
-
end
|
30
|
-
|
31
|
-
subject { test_class.new(managed_directories, desired_contents) }
|
26
|
+
subject { R10K::Util::Cleaner.new(managed_directories, desired_contents) }
|
32
27
|
|
33
28
|
context 'without recurse option' do
|
34
29
|
let(:recurse) { false }
|
@@ -104,7 +99,13 @@ RSpec.describe R10K::Util::Purgeable do
|
|
104
99
|
|
105
100
|
describe '#current_contents' do
|
106
101
|
it 'collects contents of all managed directories recursively' do
|
107
|
-
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/)
|
108
109
|
end
|
109
110
|
end
|
110
111
|
|
@@ -120,7 +121,8 @@ RSpec.describe R10K::Util::Purgeable do
|
|
120
121
|
let(:whitelist) { [] }
|
121
122
|
|
122
123
|
it 'collects current_contents that should not exist recursively' do
|
123
|
-
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/)
|
124
126
|
end
|
125
127
|
end
|
126
128
|
|
@@ -130,7 +132,17 @@ RSpec.describe R10K::Util::Purgeable do
|
|
130
132
|
|
131
133
|
it 'collects current_contents that should not exist except whitelisted items' do
|
132
134
|
expect(subject.logger).to receive(:debug).with(/unmanaged_1.*whitelist match/i)
|
133
|
-
|
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/)
|
134
146
|
end
|
135
147
|
end
|
136
148
|
|
@@ -140,7 +152,17 @@ RSpec.describe R10K::Util::Purgeable do
|
|
140
152
|
|
141
153
|
it 'collects current_contents that should not exist except excluded items' do
|
142
154
|
expect(subject.logger).to receive(:debug2).with(/unmanaged_2.*internal exclusion match/i)
|
143
|
-
|
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/)
|
144
166
|
end
|
145
167
|
end
|
146
168
|
end
|
@@ -185,7 +207,11 @@ RSpec.describe R10K::Util::Purgeable do
|
|
185
207
|
end
|
186
208
|
|
187
209
|
context "recursive whitelist glob" do
|
188
|
-
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
|
189
215
|
let(:purge_opts) { { recurse: true, whitelist: whitelist } }
|
190
216
|
|
191
217
|
describe '#purge!' do
|
@@ -220,7 +246,7 @@ RSpec.describe R10K::Util::Purgeable do
|
|
220
246
|
context "when class does not implement #purge_exclusions" do
|
221
247
|
describe '#purge!' do
|
222
248
|
it 'purges normally' do
|
223
|
-
expect(FileUtils).to receive(:rm_r).at_least(
|
249
|
+
expect(FileUtils).to receive(:rm_r).at_least(4).times
|
224
250
|
|
225
251
|
subject.purge!(purge_opts)
|
226
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
|
@@ -199,6 +199,7 @@ files:
|
|
199
199
|
- ".github/workflows/docker.yml"
|
200
200
|
- ".github/workflows/release.yml"
|
201
201
|
- ".github/workflows/rspec_tests.yml"
|
202
|
+
- ".github/workflows/stale.yml"
|
202
203
|
- ".gitignore"
|
203
204
|
- ".travis.yml"
|
204
205
|
- CHANGELOG.mkd
|
@@ -346,6 +347,7 @@ files:
|
|
346
347
|
- lib/r10k/cli/help.rb
|
347
348
|
- lib/r10k/cli/puppetfile.rb
|
348
349
|
- lib/r10k/cli/version.rb
|
350
|
+
- lib/r10k/content_synchronizer.rb
|
349
351
|
- lib/r10k/deployment.rb
|
350
352
|
- lib/r10k/deployment/config.rb
|
351
353
|
- lib/r10k/environment.rb
|
@@ -391,6 +393,8 @@ files:
|
|
391
393
|
- lib/r10k/module/local.rb
|
392
394
|
- lib/r10k/module/metadata_file.rb
|
393
395
|
- lib/r10k/module/svn.rb
|
396
|
+
- lib/r10k/module_loader/puppetfile.rb
|
397
|
+
- lib/r10k/module_loader/puppetfile/dsl.rb
|
394
398
|
- lib/r10k/puppetfile.rb
|
395
399
|
- lib/r10k/settings.rb
|
396
400
|
- lib/r10k/settings/collection.rb
|
@@ -415,6 +419,7 @@ files:
|
|
415
419
|
- lib/r10k/svn/working_dir.rb
|
416
420
|
- lib/r10k/util/attempt.rb
|
417
421
|
- lib/r10k/util/basedir.rb
|
422
|
+
- lib/r10k/util/cleaner.rb
|
418
423
|
- lib/r10k/util/commands.rb
|
419
424
|
- lib/r10k/util/exec_env.rb
|
420
425
|
- lib/r10k/util/license.rb
|
@@ -443,6 +448,8 @@ files:
|
|
443
448
|
- spec/fixtures/unit/action/r10k.yaml
|
444
449
|
- spec/fixtures/unit/action/r10k_cachedir.yaml
|
445
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
|
446
453
|
- spec/fixtures/unit/action/r10k_generate_types.yaml
|
447
454
|
- spec/fixtures/unit/action/r10k_puppet_path.yaml
|
448
455
|
- spec/fixtures/unit/puppetfile/argument-error/Puppetfile
|
@@ -454,9 +461,11 @@ files:
|
|
454
461
|
- spec/fixtures/unit/puppetfile/valid-forge-with-version/Puppetfile
|
455
462
|
- spec/fixtures/unit/puppetfile/valid-forge-without-version/Puppetfile
|
456
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
|
457
465
|
- spec/fixtures/unit/util/purgeable/managed_one/managed_subdir_1/subdir_expected_1
|
458
466
|
- spec/fixtures/unit/util/purgeable/managed_one/managed_subdir_1/subdir_unmanaged_1
|
459
467
|
- spec/fixtures/unit/util/purgeable/managed_one/unmanaged_1
|
468
|
+
- spec/fixtures/unit/util/purgeable/managed_two/.hidden/unmanaged_3
|
460
469
|
- spec/fixtures/unit/util/purgeable/managed_two/expected_2
|
461
470
|
- spec/fixtures/unit/util/purgeable/managed_two/unmanaged_2
|
462
471
|
- spec/fixtures/unit/util/subprocess/runner/no-execute.sh
|
@@ -522,6 +531,7 @@ files:
|
|
522
531
|
- spec/unit/module/git_spec.rb
|
523
532
|
- spec/unit/module/metadata_file_spec.rb
|
524
533
|
- spec/unit/module/svn_spec.rb
|
534
|
+
- spec/unit/module_loader/puppetfile_spec.rb
|
525
535
|
- spec/unit/module_spec.rb
|
526
536
|
- spec/unit/puppetfile_spec.rb
|
527
537
|
- spec/unit/settings/collection_spec.rb
|