r10k 3.9.0 → 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/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/fixtures/unit/util/purgeable/managed_one/managed_subdir_1/managed_subdir_2/ignored_1
ADDED
File without changes
|
File without changes
|
@@ -8,6 +8,6 @@ class R10K::Source::Mock < R10K::Source::Base
|
|
8
8
|
corrected_environment_names = @options[:environments].map do |env|
|
9
9
|
R10K::Environment::Name.new(env, :prefix => @prefix, :invalid => 'correct_and_warn')
|
10
10
|
end
|
11
|
-
corrected_environment_names.map { |env| R10K::Environment::Mock.new(env.name, @basedir, env.dirname) }
|
11
|
+
corrected_environment_names.map { |env| R10K::Environment::Mock.new(env.name, @basedir, env.dirname, { overrides: @options[:overrides] }) }
|
12
12
|
end
|
13
13
|
end
|
@@ -3,15 +3,15 @@ require 'spec_helper'
|
|
3
3
|
shared_examples_for "a puppetfile action" do
|
4
4
|
describe "initializing" do
|
5
5
|
it "accepts the :root option" do
|
6
|
-
described_class.new({root: "/some/nonexistent/path"}, [])
|
6
|
+
described_class.new({root: "/some/nonexistent/path"}, [], {})
|
7
7
|
end
|
8
8
|
|
9
9
|
it "accepts the :puppetfile option" do
|
10
|
-
described_class.new({puppetfile: "/some/nonexistent/path/Puppetfile"}, [])
|
10
|
+
described_class.new({puppetfile: "/some/nonexistent/path/Puppetfile"}, [], {})
|
11
11
|
end
|
12
12
|
|
13
13
|
it "accepts the :moduledir option" do
|
14
|
-
described_class.new({moduledir: "/some/nonexistent/path/modules"}, [])
|
14
|
+
described_class.new({moduledir: "/some/nonexistent/path/modules"}, [], {})
|
15
15
|
end
|
16
16
|
|
17
17
|
end
|
@@ -20,19 +20,19 @@ end
|
|
20
20
|
shared_examples_for "a puppetfile install action" do
|
21
21
|
describe "initializing" do
|
22
22
|
it "accepts the :root option" do
|
23
|
-
described_class.new({root: "/some/nonexistent/path"}, [])
|
23
|
+
described_class.new({root: "/some/nonexistent/path"}, [], {})
|
24
24
|
end
|
25
25
|
|
26
26
|
it "accepts the :puppetfile option" do
|
27
|
-
described_class.new({puppetfile: "/some/nonexistent/path/Puppetfile"}, [])
|
27
|
+
described_class.new({puppetfile: "/some/nonexistent/path/Puppetfile"}, [], {})
|
28
28
|
end
|
29
29
|
|
30
30
|
it "accepts the :moduledir option" do
|
31
|
-
described_class.new({moduledir: "/some/nonexistent/path/modules"}, [])
|
31
|
+
described_class.new({moduledir: "/some/nonexistent/path/modules"}, [], {})
|
32
32
|
end
|
33
33
|
|
34
34
|
it "accepts the :force option" do
|
35
|
-
described_class.new({force: true}, [])
|
35
|
+
described_class.new({force: true}, [], {})
|
36
36
|
end
|
37
37
|
|
38
38
|
end
|
@@ -5,31 +5,57 @@ require 'r10k/action/deploy/display'
|
|
5
5
|
describe R10K::Action::Deploy::Display do
|
6
6
|
describe "initializing" do
|
7
7
|
it "accepts a puppetfile option" do
|
8
|
-
described_class.new({puppetfile: true}, [])
|
8
|
+
described_class.new({puppetfile: true}, [], {})
|
9
9
|
end
|
10
10
|
|
11
11
|
it "accepts a modules option" do
|
12
|
-
described_class.new({modules: true}, [])
|
12
|
+
described_class.new({modules: true}, [], {})
|
13
13
|
end
|
14
14
|
|
15
15
|
it "accepts a detail option" do
|
16
|
-
described_class.new({detail: true}, [])
|
16
|
+
described_class.new({detail: true}, [], {})
|
17
17
|
end
|
18
18
|
|
19
19
|
it "accepts a format option" do
|
20
|
-
described_class.new({format: "json"}, [])
|
20
|
+
described_class.new({format: "json"}, [], {})
|
21
21
|
end
|
22
22
|
|
23
23
|
it "accepts a fetch option" do
|
24
|
-
described_class.new({fetch: true}, [])
|
24
|
+
described_class.new({fetch: true}, [], {})
|
25
25
|
end
|
26
26
|
end
|
27
27
|
|
28
|
-
subject { described_class.new({config: "/some/nonexistent/path"}, []) }
|
28
|
+
subject { described_class.new({config: "/some/nonexistent/path"}, [], {}) }
|
29
29
|
|
30
30
|
before do
|
31
31
|
allow(subject).to receive(:puts)
|
32
32
|
end
|
33
33
|
|
34
34
|
it_behaves_like "a deploy action that requires a config file"
|
35
|
+
|
36
|
+
describe "collecting info" do
|
37
|
+
subject { described_class.new({config: "/some/nonexistent/path", format: 'json', puppetfile: true, detail: true}, ['first'], {}) }
|
38
|
+
|
39
|
+
let(:mock_config) do
|
40
|
+
R10K::Deployment::MockConfig.new(
|
41
|
+
:sources => {
|
42
|
+
:control => {
|
43
|
+
:type => :mock,
|
44
|
+
:basedir => '/some/nonexistent/path/control',
|
45
|
+
:environments => %w[first second third env-that/will-be-corrected],
|
46
|
+
:prefix => 'PREFIX'
|
47
|
+
}
|
48
|
+
}
|
49
|
+
)
|
50
|
+
end
|
51
|
+
|
52
|
+
let(:deployment) { R10K::Deployment.new(mock_config) }
|
53
|
+
|
54
|
+
it "gathers environment info" do
|
55
|
+
source_info = subject.send(:source_info, deployment.sources.first, ['first'])
|
56
|
+
expect(source_info[:name]).to eq(:control)
|
57
|
+
expect(source_info[:environments].length).to eq(1)
|
58
|
+
expect(source_info[:environments][0][:name]).to eq('first')
|
59
|
+
end
|
60
|
+
end
|
35
61
|
end
|
@@ -5,46 +5,46 @@ require 'r10k/action/deploy/environment'
|
|
5
5
|
|
6
6
|
describe R10K::Action::Deploy::Environment do
|
7
7
|
|
8
|
-
subject { described_class.new({config: "/some/nonexistent/path"}, []) }
|
8
|
+
subject { described_class.new({config: "/some/nonexistent/path"}, [], {}) }
|
9
9
|
|
10
10
|
it_behaves_like "a deploy action that can be write locked"
|
11
11
|
it_behaves_like "a deploy action that requires a config file"
|
12
12
|
|
13
13
|
describe "initializing" do
|
14
14
|
it "can accept a cachedir option" do
|
15
|
-
described_class.new({cachedir: "/some/nonexistent/cachedir"}, [])
|
15
|
+
described_class.new({cachedir: "/some/nonexistent/cachedir"}, [], {})
|
16
16
|
end
|
17
17
|
|
18
18
|
it "can accept a puppetfile option" do
|
19
|
-
described_class.new({puppetfile: true}, [])
|
19
|
+
described_class.new({puppetfile: true}, [], {})
|
20
20
|
end
|
21
21
|
|
22
22
|
it "can accept a modules option" do
|
23
|
-
described_class.new({modules: true}, [])
|
23
|
+
described_class.new({modules: true}, [], {})
|
24
24
|
end
|
25
25
|
|
26
26
|
it "can accept a default_branch_override option" do
|
27
|
-
described_class.new({:'default-branch-override' => 'default_branch_override_name'}, [])
|
27
|
+
described_class.new({:'default-branch-override' => 'default_branch_override_name'}, [], {})
|
28
28
|
end
|
29
29
|
|
30
30
|
it "can accept a no-force option" do
|
31
|
-
described_class.new({:'no-force' => true}, [])
|
31
|
+
described_class.new({:'no-force' => true}, [], {})
|
32
32
|
end
|
33
33
|
|
34
34
|
it 'can accept a generate-types option' do
|
35
|
-
described_class.new({ 'generate-types': true }, [])
|
35
|
+
described_class.new({ 'generate-types': true }, [], {})
|
36
36
|
end
|
37
37
|
|
38
38
|
it 'can accept a puppet-path option' do
|
39
|
-
described_class.new({ 'puppet-path': '/nonexistent' }, [])
|
39
|
+
described_class.new({ 'puppet-path': '/nonexistent' }, [], {})
|
40
40
|
end
|
41
41
|
|
42
42
|
it 'can accept a private-key option' do
|
43
|
-
described_class.new({ 'private-key': '/nonexistent' }, [])
|
43
|
+
described_class.new({ 'private-key': '/nonexistent' }, [], {})
|
44
44
|
end
|
45
45
|
|
46
46
|
it 'can accept a token option' do
|
47
|
-
described_class.new({ 'oauth-token': '/nonexistent' }, [])
|
47
|
+
described_class.new({ 'oauth-token': '/nonexistent' }, [], {})
|
48
48
|
end
|
49
49
|
|
50
50
|
describe "initializing errors" do
|
@@ -83,14 +83,14 @@ describe R10K::Action::Deploy::Environment do
|
|
83
83
|
end
|
84
84
|
|
85
85
|
it "syncs the puppetfile when given the puppetfile flag" do
|
86
|
-
expect(puppetfile).to receive(:
|
87
|
-
action = described_class.new({config: "/some/nonexistent/path", puppetfile: true}, [])
|
86
|
+
expect(puppetfile).to receive(:sync)
|
87
|
+
action = described_class.new({config: "/some/nonexistent/path", puppetfile: true}, [], {})
|
88
88
|
action.call
|
89
89
|
end
|
90
90
|
|
91
91
|
it "syncs the puppetfile when given the modules flag" do
|
92
|
-
expect(puppetfile).to receive(:
|
93
|
-
action = described_class.new({config: "/some/nonexistent/path", modules: true}, [])
|
92
|
+
expect(puppetfile).to receive(:sync)
|
93
|
+
action = described_class.new({config: "/some/nonexistent/path", modules: true}, [], {})
|
94
94
|
action.call
|
95
95
|
end
|
96
96
|
|
@@ -105,7 +105,7 @@ describe R10K::Action::Deploy::Environment do
|
|
105
105
|
expect(R10K::Deployment).to receive(:new).and_return(deployment)
|
106
106
|
end
|
107
107
|
|
108
|
-
subject { described_class.new({config: "/some/nonexistent/path"}, %w[not_an_environment]) }
|
108
|
+
subject { described_class.new({config: "/some/nonexistent/path"}, %w[not_an_environment], {}) }
|
109
109
|
|
110
110
|
it "logs that the environments can't be deployed and returns false" do
|
111
111
|
expect(subject.logger).to receive(:error).with("Environment(s) 'not_an_environment' cannot be found in any source and will not be deployed.")
|
@@ -115,10 +115,10 @@ describe R10K::Action::Deploy::Environment do
|
|
115
115
|
end
|
116
116
|
|
117
117
|
describe "with no-force" do
|
118
|
-
subject { described_class.new({ config: "/some/nonexistent/path", modules: true, :'no-force' => true}, %w[first]) }
|
118
|
+
subject { described_class.new({ config: "/some/nonexistent/path", modules: true, :'no-force' => true}, %w[first], {}) }
|
119
119
|
|
120
120
|
it "tries to preserve local modifications" do
|
121
|
-
expect(subject.force).to equal(false)
|
121
|
+
expect(subject.settings[:overrides][:modules][:force]).to equal(false)
|
122
122
|
end
|
123
123
|
end
|
124
124
|
|
@@ -206,21 +206,13 @@ describe R10K::Action::Deploy::Environment do
|
|
206
206
|
end
|
207
207
|
end
|
208
208
|
|
209
|
-
describe 'extracting credentials' do
|
210
|
-
let(:deployment) do
|
211
|
-
R10K::Deployment.new(mock_config)
|
212
|
-
end
|
213
|
-
|
214
|
-
end
|
215
|
-
|
216
209
|
describe "Purging white/allowlist" do
|
217
210
|
|
218
211
|
let(:settings) { { deploy: { purge_levels: [:environment], purge_allowlist: ['coolfile', 'coolfile2'] } } }
|
219
|
-
|
212
|
+
let(:overrides) { { environments: {}, modules: {}, purging: { purge_levels: [:environment], purge_allowlist: ['coolfile', 'coolfile2'] } } }
|
220
213
|
let(:deployment) do
|
221
|
-
R10K::Deployment.new(mock_config.merge(
|
214
|
+
R10K::Deployment.new(mock_config.merge(overrides))
|
222
215
|
end
|
223
|
-
|
224
216
|
before do
|
225
217
|
expect(R10K::Deployment).to receive(:new).and_return(deployment)
|
226
218
|
end
|
@@ -229,7 +221,7 @@ describe R10K::Action::Deploy::Environment do
|
|
229
221
|
|
230
222
|
it "reads in the purge_allowlist setting and purges accordingly" do
|
231
223
|
expect(subject.logger).to receive(:debug).with(/purging unmanaged content for environment/i)
|
232
|
-
expect(subject.
|
224
|
+
expect(subject.settings[:overrides][:purging][:purge_allowlist]).to eq(['coolfile', 'coolfile2'])
|
233
225
|
subject.call
|
234
226
|
end
|
235
227
|
|
@@ -238,7 +230,7 @@ describe R10K::Action::Deploy::Environment do
|
|
238
230
|
|
239
231
|
it "reads in the purge_whitelist setting and still sets it to purge_allowlist and purges accordingly" do
|
240
232
|
expect(subject.logger).to receive(:debug).with(/purging unmanaged content for environment/i)
|
241
|
-
expect(subject.
|
233
|
+
expect(subject.settings[:overrides][:purging][:purge_allowlist]).to eq(['coolfile', 'coolfile2'])
|
242
234
|
subject.call
|
243
235
|
end
|
244
236
|
end
|
@@ -246,9 +238,22 @@ describe R10K::Action::Deploy::Environment do
|
|
246
238
|
|
247
239
|
describe "purge_levels" do
|
248
240
|
let(:settings) { { deploy: { purge_levels: purge_levels } } }
|
241
|
+
let(:overrides) do
|
242
|
+
{
|
243
|
+
environments: {
|
244
|
+
requested_environments: ['PREFIX_first']
|
245
|
+
},
|
246
|
+
modules: {
|
247
|
+
deploy_modules: true
|
248
|
+
},
|
249
|
+
purging: {
|
250
|
+
purge_levels: purge_levels
|
251
|
+
}
|
252
|
+
}
|
253
|
+
end
|
249
254
|
|
250
255
|
let(:deployment) do
|
251
|
-
R10K::Deployment.new(mock_config.merge(
|
256
|
+
R10K::Deployment.new(mock_config.merge({ overrides: overrides }))
|
252
257
|
end
|
253
258
|
|
254
259
|
before do
|
@@ -260,10 +265,23 @@ describe R10K::Action::Deploy::Environment do
|
|
260
265
|
describe "deployment purge level" do
|
261
266
|
let(:purge_levels) { [:deployment] }
|
262
267
|
|
268
|
+
|
269
|
+
it "updates the source's cache before it purges environments" do
|
270
|
+
deployment.sources.each do |source|
|
271
|
+
expect(source).to receive(:reload!).ordered
|
272
|
+
end
|
273
|
+
expect(deployment).to receive(:purge!).ordered
|
274
|
+
subject.call
|
275
|
+
end
|
276
|
+
|
263
277
|
it "only logs about purging deployment" do
|
278
|
+
expect(subject).to receive(:visit_environment).and_wrap_original do |original, env, &block|
|
279
|
+
expect(env.logger).to_not receive(:debug).with(/purging unmanaged puppetfile content/i)
|
280
|
+
original.call(env)
|
281
|
+
end.at_least(:once)
|
282
|
+
|
264
283
|
expect(subject.logger).to receive(:debug).with(/purging unmanaged environments for deployment/i)
|
265
284
|
expect(subject.logger).to_not receive(:debug).with(/purging unmanaged content for environment/i)
|
266
|
-
expect(subject.logger).to_not receive(:debug).with(/purging unmanaged puppetfile content/i)
|
267
285
|
|
268
286
|
subject.call
|
269
287
|
end
|
@@ -273,15 +291,23 @@ describe R10K::Action::Deploy::Environment do
|
|
273
291
|
let(:purge_levels) { [:environment] }
|
274
292
|
|
275
293
|
it "only logs about purging environment" do
|
294
|
+
expect(subject).to receive(:visit_environment).and_wrap_original do |original, env, &block|
|
295
|
+
expect(env.logger).to_not receive(:debug).with(/purging unmanaged puppetfile content/i)
|
296
|
+
original.call(env)
|
297
|
+
end.at_least(:once)
|
276
298
|
expect(subject.logger).to receive(:debug).with(/purging unmanaged content for environment/i)
|
277
299
|
expect(subject.logger).to_not receive(:debug).with(/purging unmanaged environments for deployment/i)
|
278
|
-
expect(subject.logger).to_not receive(:debug).with(/purging unmanaged puppetfile content/i)
|
279
300
|
|
280
301
|
subject.call
|
281
302
|
end
|
282
303
|
|
283
304
|
it "logs that environment was not purged if deploy failed" do
|
284
|
-
expect(subject).to receive(:
|
305
|
+
expect(subject).to receive(:visit_environment).and_wrap_original do |original, env, &block|
|
306
|
+
if env.name =~ /first/
|
307
|
+
expect(env).to receive(:deploy) { subject.instance_variable_set(:@visit_ok, false) }
|
308
|
+
end
|
309
|
+
original.call(env)
|
310
|
+
end.at_least(:once)
|
285
311
|
|
286
312
|
expect(subject.logger).to receive(:debug).with(/not purging unmanaged content for environment/i)
|
287
313
|
|
@@ -293,7 +319,13 @@ describe R10K::Action::Deploy::Environment do
|
|
293
319
|
let(:purge_levels) { [:puppetfile] }
|
294
320
|
|
295
321
|
it "only logs about purging puppetfile" do
|
296
|
-
expect(subject
|
322
|
+
expect(subject).to receive(:visit_environment).and_wrap_original do |original, env, &block|
|
323
|
+
if env.name =~ /first/
|
324
|
+
expect(env.logger).to receive(:debug).with(/purging unmanaged puppetfile content/i)
|
325
|
+
end
|
326
|
+
original.call(env)
|
327
|
+
end.at_least(:once)
|
328
|
+
|
297
329
|
expect(subject.logger).to_not receive(:debug).with(/purging unmanaged environments for deployment/i)
|
298
330
|
expect(subject.logger).to_not receive(:debug).with(/purging unmanaged content for environment/i)
|
299
331
|
|
@@ -334,16 +366,19 @@ describe R10K::Action::Deploy::Environment do
|
|
334
366
|
modules: true,
|
335
367
|
'generate-types': true
|
336
368
|
},
|
337
|
-
%w[first second]
|
369
|
+
%w[first second],
|
370
|
+
{}
|
338
371
|
)
|
339
372
|
end
|
340
373
|
|
341
374
|
it 'generate_types is true' do
|
342
|
-
expect(subject.
|
375
|
+
expect(subject.settings[:overrides][:environments][:generate_types]).to eq(true)
|
343
376
|
end
|
344
377
|
|
345
378
|
it 'only calls puppet generate types on specified environment' do
|
346
|
-
subject.
|
379
|
+
settings = subject.instance_variable_get(:@settings)
|
380
|
+
settings[:overrides][:environments][:requested_environments] = %w{first}
|
381
|
+
subject.instance_variable_set(:@settings, settings)
|
347
382
|
expect(subject).to receive(:visit_environment).and_wrap_original do |original, environment, &block|
|
348
383
|
if environment.dirname == 'first'
|
349
384
|
expect(environment).to receive(:generate_types!)
|
@@ -356,8 +391,8 @@ describe R10K::Action::Deploy::Environment do
|
|
356
391
|
end
|
357
392
|
|
358
393
|
it 'does not call puppet generate types on puppetfile failure' do
|
359
|
-
allow(subject).to receive(:visit_puppetfile) { subject.instance_variable_set(:@visit_ok, false) }
|
360
394
|
expect(subject).to receive(:visit_environment).and_wrap_original do |original, environment, &block|
|
395
|
+
allow(environment).to receive(:deploy) { subject.instance_variable_set(:@visit_ok, false) }
|
361
396
|
expect(environment).not_to receive(:generate_types!)
|
362
397
|
original.call(environment, &block)
|
363
398
|
end.twice
|
@@ -365,10 +400,11 @@ describe R10K::Action::Deploy::Environment do
|
|
365
400
|
end
|
366
401
|
|
367
402
|
it 'calls puppet generate types on previous puppetfile failure' do
|
368
|
-
allow(subject).to receive(:visit_puppetfile) do |puppetfile|
|
369
|
-
subject.instance_variable_set(:@visit_ok, false) if puppetfile.environment.dirname == 'first'
|
370
|
-
end
|
371
403
|
expect(subject).to receive(:visit_environment).and_wrap_original do |original, environment, &block|
|
404
|
+
allow(environment).to receive(:deploy) do
|
405
|
+
subject.instance_variable_set(:@visit_ok, false) if environment.dirname == 'first'
|
406
|
+
end
|
407
|
+
|
372
408
|
if environment.dirname == 'second'
|
373
409
|
expect(environment).to receive(:generate_types!)
|
374
410
|
else
|
@@ -388,12 +424,13 @@ describe R10K::Action::Deploy::Environment do
|
|
388
424
|
modules: true,
|
389
425
|
'generate-types': false
|
390
426
|
},
|
391
|
-
%w[first]
|
427
|
+
%w[first],
|
428
|
+
{}
|
392
429
|
)
|
393
430
|
end
|
394
431
|
|
395
432
|
it 'generate_types is false' do
|
396
|
-
expect(subject.
|
433
|
+
expect(subject.settings[:overrides][:environments][:generate_types]).to eq(false)
|
397
434
|
end
|
398
435
|
|
399
436
|
it 'does not call puppet generate types' do
|
@@ -408,7 +445,7 @@ describe R10K::Action::Deploy::Environment do
|
|
408
445
|
|
409
446
|
describe 'with puppet-path' do
|
410
447
|
|
411
|
-
subject { described_class.new({ config: '/some/nonexistent/path', 'puppet-path': '/nonexistent' }, []) }
|
448
|
+
subject { described_class.new({ config: '/some/nonexistent/path', 'puppet-path': '/nonexistent' }, [], {}) }
|
412
449
|
|
413
450
|
it 'sets puppet_path' do
|
414
451
|
expect(subject.instance_variable_get(:@puppet_path)).to eq('/nonexistent')
|
@@ -417,7 +454,7 @@ describe R10K::Action::Deploy::Environment do
|
|
417
454
|
|
418
455
|
describe 'with puppet-conf' do
|
419
456
|
|
420
|
-
subject { described_class.new({ config: '/some/nonexistent/path', 'puppet-conf': '/nonexistent' }, []) }
|
457
|
+
subject { described_class.new({ config: '/some/nonexistent/path', 'puppet-conf': '/nonexistent' }, [], {}) }
|
421
458
|
|
422
459
|
it 'sets puppet_conf' do
|
423
460
|
expect(subject.instance_variable_get(:@puppet_conf)).to eq('/nonexistent')
|
@@ -426,7 +463,7 @@ describe R10K::Action::Deploy::Environment do
|
|
426
463
|
|
427
464
|
describe 'with private-key' do
|
428
465
|
|
429
|
-
subject { described_class.new({ config: '/some/nonexistent/path', 'private-key': '/nonexistent' }, []) }
|
466
|
+
subject { described_class.new({ config: '/some/nonexistent/path', 'private-key': '/nonexistent' }, [], {}) }
|
430
467
|
|
431
468
|
it 'sets private_key' do
|
432
469
|
expect(subject.instance_variable_get(:@private_key)).to eq('/nonexistent')
|
@@ -435,7 +472,7 @@ describe R10K::Action::Deploy::Environment do
|
|
435
472
|
|
436
473
|
describe 'with oauth-token' do
|
437
474
|
|
438
|
-
subject { described_class.new({ config: '/some/nonexistent/path', 'oauth-token': '/nonexistent' }, []) }
|
475
|
+
subject { described_class.new({ config: '/some/nonexistent/path', 'oauth-token': '/nonexistent' }, [], {}) }
|
439
476
|
|
440
477
|
it 'sets oauth_token' do
|
441
478
|
expect(subject.instance_variable_get(:@oauth_token)).to eq('/nonexistent')
|
@@ -453,7 +490,7 @@ describe R10K::Action::Deploy::Environment do
|
|
453
490
|
def initialize(path, info)
|
454
491
|
@path = path
|
455
492
|
@info = info
|
456
|
-
@puppetfile = R10K::Puppetfile.new
|
493
|
+
@puppetfile = R10K::Puppetfile.new("", {})
|
457
494
|
end
|
458
495
|
end
|
459
496
|
|