r10k 3.3.0 → 3.3.1

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.
data/r10k.gemspec CHANGED
@@ -28,7 +28,7 @@ Gem::Specification.new do |s|
28
28
  s.add_dependency 'log4r', '1.1.10'
29
29
  s.add_dependency 'multi_json', '~> 1.10'
30
30
 
31
- s.add_dependency 'puppet_forge', '~> 2.2.8'
31
+ s.add_dependency 'puppet_forge', '~> 2.3.0'
32
32
 
33
33
  s.add_dependency 'gettext-setup', '~>0.24'
34
34
 
@@ -0,0 +1,5 @@
1
+ mod 'cd4pe',
2
+ :git => 'test@randomurl.com:something/some_module.git',
3
+ :ref => 'expected_ref',
4
+ :default_branch => 'here_lies_the_default_branch'
5
+
@@ -19,6 +19,10 @@ describe R10K::Action::Deploy::Environment do
19
19
  described_class.new({puppetfile: true}, [])
20
20
  end
21
21
 
22
+ it "can accept a default_branch_override option" do
23
+ described_class.new({:'default-branch-override' => 'default_branch_override_name'}, [])
24
+ end
25
+
22
26
  it "can accept a no-force option" do
23
27
  described_class.new({:'no-force' => true}, [])
24
28
  end
@@ -328,4 +332,63 @@ describe R10K::Action::Deploy::Environment do
328
332
  end
329
333
  end
330
334
  end
335
+
336
+ describe "write_environment_info!" do
337
+
338
+ class Fake_Environment
339
+ attr_accessor :path
340
+ attr_accessor :puppetfile
341
+ attr_accessor :info
342
+
343
+ def initialize(path, info)
344
+ @path = path
345
+ @info = info
346
+ @puppetfile = R10K::Puppetfile.new
347
+ end
348
+ end
349
+
350
+ let(:mock_stateful_repo_1) { instance_double("R10K::Git::StatefulRepository", :head => "123456") }
351
+ let(:mock_stateful_repo_2) { instance_double("R10K::Git::StatefulRepository", :head => "654321") }
352
+ let(:mock_git_module_1) { instance_double("R10K::Module::Git", :name => "my_cool_module", :version => "1.0", :repo => mock_stateful_repo_1) }
353
+ let(:mock_git_module_2) { instance_double("R10K::Module::Git", :name => "my_lame_module", :version => "0.0.1", :repo => mock_stateful_repo_2) }
354
+ let(:mock_forge_module_1) { double(:name => "their_shiny_module", :version => "2.0.0") }
355
+ let(:mock_puppetfile) { instance_double("R10K::Puppetfile", :modules => [mock_git_module_1, mock_git_module_2, mock_forge_module_1]) }
356
+
357
+ before(:all) do
358
+ @tmp_path = "./tmp-r10k-test-dir/"
359
+ Dir.mkdir(@tmp_path) unless File.exists?(@tmp_path)
360
+ end
361
+
362
+ after(:all) do
363
+ File.delete("#{@tmp_path}/.r10k-deploy.json")
364
+ Dir.delete(@tmp_path)
365
+ end
366
+
367
+ it "writes the .r10k-deploy file correctly" do
368
+ allow(R10K::Puppetfile).to receive(:new).and_return(mock_puppetfile)
369
+ allow(mock_forge_module_1).to receive(:repo).and_raise(NoMethodError)
370
+
371
+ fake_env = Fake_Environment.new(@tmp_path, {:name => "my_cool_environment", :signature => "pablo picasso"})
372
+ subject.send(:write_environment_info!, fake_env, "2019-01-01 23:23:22 +0000", true)
373
+
374
+ file_contents = File.read("#{@tmp_path}/.r10k-deploy.json")
375
+ r10k_deploy = JSON.parse(file_contents)
376
+
377
+ expect(r10k_deploy['name']).to eq("my_cool_environment")
378
+ expect(r10k_deploy['signature']).to eq("pablo picasso")
379
+ expect(r10k_deploy['started_at']).to eq("2019-01-01 23:23:22 +0000")
380
+ expect(r10k_deploy['deploy_success']).to eq(true)
381
+ expect(r10k_deploy['module_deploys'].length).to eq(3)
382
+ expect(r10k_deploy['module_deploys'][0]['name']).to eq("my_cool_module")
383
+ expect(r10k_deploy['module_deploys'][0]['version']).to eq("1.0")
384
+ expect(r10k_deploy['module_deploys'][0]['sha']).to eq("123456")
385
+ expect(r10k_deploy['module_deploys'][1]['name']).to eq("my_lame_module")
386
+ expect(r10k_deploy['module_deploys'][1]['version']).to eq("0.0.1")
387
+ expect(r10k_deploy['module_deploys'][1]['sha']).to eq("654321")
388
+ expect(r10k_deploy['module_deploys'][2]['name']).to eq("their_shiny_module")
389
+ expect(r10k_deploy['module_deploys'][2]['version']).to eq("2.0.0")
390
+ expect(r10k_deploy['module_deploys'][2]['sha']).to eq(nil)
391
+
392
+ end
393
+ end
331
394
  end
@@ -7,6 +7,7 @@ describe R10K::Forge::ModuleRelease do
7
7
  subject { described_class.new('branan-eight_hundred', '8.0.0') }
8
8
 
9
9
  let(:forge_release_class) { PuppetForge::V3::Release }
10
+ let(:sha256_digest_class) { Digest::SHA256 }
10
11
  let(:md5_digest_class) { Digest::MD5 }
11
12
 
12
13
  let(:download_path) { instance_double('Pathname') }
@@ -14,14 +15,21 @@ describe R10K::Forge::ModuleRelease do
14
15
  let(:tarball_cache_root) { instance_double('Pathname') }
15
16
  let(:unpack_path) { instance_double('Pathname') }
16
17
  let(:target_dir) { instance_double('Pathname') }
18
+ let(:tarball_cache_path) { instance_double('Pathname') }
17
19
  let(:md5_file_path) { instance_double('Pathname') }
20
+ let(:sha256_file_path) { instance_double('Pathname') }
18
21
 
19
22
  let(:file_lists) { {:valid=>['valid_ex'], :invalid=>[], :symlinks=>['symlink_ex']} }
20
23
 
21
24
  let(:file_contents) { "skeletor's closet" }
22
- let(:md5_of_tarball) { "something_hexy" }
25
+ let(:sha256_digest) { instance_double('Digest::SHA256') }
26
+ let(:sha256_of_tarball) { "sha256_hash" }
27
+ let(:md5_digest) { instance_double('Digest::MD5') }
28
+ let(:md5_of_tarball) { "md5_hash" }
23
29
  let(:good_md5) { md5_of_tarball }
24
- let(:bad_md5) { "different_hexy_thing" }
30
+ let(:good_sha256) { sha256_of_tarball }
31
+ let(:bad_sha256) { "bad_sha256_hash" }
32
+ let(:bad_md5) { "bad_md5_hash" }
25
33
 
26
34
  before do
27
35
  subject.download_path = download_path
@@ -29,6 +37,7 @@ describe R10K::Forge::ModuleRelease do
29
37
  subject.tarball_cache_root = tarball_cache_root
30
38
  subject.unpack_path = unpack_path
31
39
  subject.md5_file_path = md5_file_path
40
+ subject.sha256_file_path = sha256_file_path
32
41
  end
33
42
 
34
43
  context "no cached tarball" do
@@ -55,51 +64,78 @@ describe R10K::Forge::ModuleRelease do
55
64
 
56
65
  describe '#verify' do
57
66
 
58
- it "verifies using the file md5, if that exists" do
59
- allow(File).to receive(:read).and_return(file_contents)
60
- allow(md5_digest_class).to receive(:hexdigest).and_return(md5_of_tarball)
61
- allow(md5_file_path).to receive(:exist?).and_return(true)
62
- expect(subject).to receive(:verify_from_md5_file).with(md5_of_tarball)
67
+ it "verifies using the file SHA256, if that exists" do
68
+ allow(sha256_digest_class).to receive(:file).and_return(sha256_digest)
69
+ allow(sha256_digest).to receive(:hexdigest).and_return(sha256_of_tarball)
70
+ allow(sha256_file_path).to receive(:exist?).and_return(true)
71
+ expect(subject).to receive(:verify_from_file).with(sha256_of_tarball, sha256_file_path)
63
72
  subject.verify
64
73
  end
65
74
 
66
- it "verifies using the forge file_md5, if no md5 file exists" do
67
- allow(File).to receive(:read).and_return(file_contents)
68
- allow(md5_digest_class).to receive(:hexdigest).and_return(md5_of_tarball)
69
- allow(md5_file_path).to receive(:exist?).and_return(false)
70
- expect(subject).to receive(:verify_from_forge).with(md5_of_tarball)
75
+ it "verifies using the forge file_sha256, if no sha256 file exists" do
76
+ allow(sha256_digest_class).to receive(:file).and_return(sha256_digest)
77
+ allow(sha256_digest).to receive(:hexdigest).and_return(sha256_of_tarball)
78
+ allow(sha256_file_path).to receive(:exist?).and_return(false)
79
+ allow(subject.forge_release).to receive(:respond_to?).and_return(true)
80
+ allow(subject.forge_release).to receive(:sha256_file).and_return(sha256_of_tarball)
81
+ expect(subject).to receive(:verify_from_forge)
71
82
  subject.verify
72
83
  end
84
+
85
+ it "falls back to md5 verification when not in FIPS mode and no sha256 available" do
86
+ expect(R10K::Util::Platform).to receive(:fips?).and_return(false)
87
+ # failed sha256 verification
88
+ allow(sha256_digest_class).to receive(:file).and_return(sha256_digest)
89
+ allow(sha256_digest).to receive(:hexdigest).and_return(sha256_of_tarball)
90
+ allow(sha256_file_path).to receive(:exist?).and_return(false)
91
+ allow(subject.forge_release).to receive(:respond_to?).and_return(false)
92
+ allow(subject).to receive(:verify_from_forge)
93
+ # md5 verification
94
+ allow(md5_digest_class).to receive(:file).and_return(md5_digest)
95
+ allow(md5_digest).to receive(:hexdigest).and_return(md5_of_tarball)
96
+ allow(md5_file_path).to receive(:exist?).and_return(true)
97
+ expect(subject).to receive(:verify_from_file)
98
+ subject.verify
99
+ end
100
+
101
+ it "errors when in FIPS mode and no sha256 is available" do
102
+ expect(R10K::Util::Platform).to receive(:fips?).and_return(true)
103
+ allow(sha256_digest_class).to receive(:file).and_return(sha256_digest)
104
+ allow(sha256_digest).to receive(:hexdigest).and_return(sha256_of_tarball)
105
+ allow(sha256_file_path).to receive(:exist?).and_return(false)
106
+ allow(subject.forge_release).to receive(:respond_to?).and_return(false)
107
+ allow(subject).to receive(:verify_from_forge)
108
+ expect { subject.verify }.to raise_error(R10K::Error)
109
+ end
73
110
  end
74
111
 
75
- describe '#verify_from_md5_file' do
112
+ describe '#verify_from_file' do
76
113
 
77
114
  it "does nothing when the checksums match" do
78
- expect(File).to receive(:read).with(md5_file_path).and_return(good_md5)
115
+ expect(File).to receive(:read).with(sha256_file_path).and_return(good_sha256)
79
116
  expect(subject).not_to receive(:cleanup_cached_tarball_path)
80
- subject.verify_from_md5_file(md5_of_tarball)
117
+ subject.verify_from_file(sha256_of_tarball, sha256_file_path)
81
118
  end
82
119
 
83
120
  it "raises an error and cleans up when the checksums do not match" do
84
- expect(File).to receive(:read).with(md5_file_path).and_return(bad_md5)
85
- expect(subject).to receive(:cleanup_cached_tarball_path)
86
- expect(subject).to receive(:cleanup_md5_file_path)
87
- expect { subject.verify_from_md5_file(md5_of_tarball) }.to raise_error(PuppetForge::V3::Release::ChecksumMismatch)
121
+ expect(File).to receive(:read).with(sha256_file_path).and_return(bad_sha256)
122
+ expect(tarball_cache_path).to receive(:delete)
123
+ expect(sha256_file_path).to receive(:delete)
124
+ expect { subject.verify_from_file(sha256_of_tarball, sha256_file_path) }.to raise_error(PuppetForge::V3::Release::ChecksumMismatch)
88
125
  end
89
126
  end
90
127
 
91
128
  describe '#verify_from_forge' do
92
- it "write the md5 to file when the checksums match" do
93
- expect(subject.forge_release).to receive(:file_md5).and_return(good_md5)
94
- expect(subject).not_to receive(:cleanup_cached_tarball_path)
95
- expect(File).to receive(:write).with(md5_file_path, good_md5)
96
- subject.verify_from_forge(md5_of_tarball)
129
+ it "write the checksum to file when the checksums match" do
130
+ expect(tarball_cache_path).not_to receive(:delete)
131
+ expect(File).to receive(:write).with(sha256_file_path, good_sha256)
132
+ subject.verify_from_forge(sha256_of_tarball, good_sha256, sha256_file_path)
97
133
  end
98
134
 
99
135
  it "raises an error and cleans up when the checksums do not match" do
100
- expect(subject.forge_release).to receive(:file_md5).and_return(bad_md5)
101
- expect(subject).to receive(:cleanup_cached_tarball_path)
102
- expect { subject.verify_from_forge(md5_of_tarball) }.to raise_error(PuppetForge::V3::Release::ChecksumMismatch)
136
+ expect(tarball_cache_path).to receive(:delete)
137
+ expect { subject.verify_from_forge(sha256_of_tarball, bad_sha256, sha256_file_path) }
138
+ .to raise_error(PuppetForge::V3::Release::ChecksumMismatch)
103
139
  end
104
140
  end
105
141
 
@@ -227,6 +227,25 @@ describe R10K::Puppetfile do
227
227
  subject = described_class.new(path)
228
228
  expect { subject.load! }.not_to raise_error
229
229
  end
230
+
231
+ it "creates a git module and applies the default branch sepcified in the Puppetfile" do
232
+ path = File.join(PROJECT_ROOT, 'spec', 'fixtures', 'unit', 'puppetfile', 'default-branch-override')
233
+ pf_path = File.join(path, 'Puppetfile')
234
+ subject = described_class.new(path)
235
+ expect { subject.load! }.not_to raise_error
236
+ git_module = subject.modules[0]
237
+ expect(git_module.default_ref).to eq 'here_lies_the_default_branch'
238
+ end
239
+
240
+ it "creates a git module and applies the provided default_branch_override" do
241
+ path = File.join(PROJECT_ROOT, 'spec', 'fixtures', 'unit', 'puppetfile', 'default-branch-override')
242
+ pf_path = File.join(path, 'Puppetfile')
243
+ subject = described_class.new(path)
244
+ default_branch_override = 'default_branch_override_name'
245
+ expect { subject.load!(default_branch_override) }.not_to raise_error
246
+ git_module = subject.modules[0]
247
+ expect(git_module.default_ref).to eq default_branch_override
248
+ end
230
249
  end
231
250
 
232
251
  describe "accepting a visitor" do
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.3.0
4
+ version: 3.3.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Adrien Thebo
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-06-03 00:00:00.000000000 Z
11
+ date: 2019-08-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: colored
@@ -72,14 +72,14 @@ dependencies:
72
72
  requirements:
73
73
  - - "~>"
74
74
  - !ruby/object:Gem::Version
75
- version: 2.2.8
75
+ version: 2.3.0
76
76
  type: :runtime
77
77
  prerelease: false
78
78
  version_requirements: !ruby/object:Gem::Requirement
79
79
  requirements:
80
80
  - - "~>"
81
81
  - !ruby/object:Gem::Version
82
- version: 2.2.8
82
+ version: 2.3.0
83
83
  - !ruby/object:Gem::Dependency
84
84
  name: gettext-setup
85
85
  requirement: !ruby/object:Gem::Requirement
@@ -164,6 +164,7 @@ files:
164
164
  - ".gitignore"
165
165
  - ".travis.yml"
166
166
  - CHANGELOG.mkd
167
+ - CODEOWNERS
167
168
  - CONTRIBUTING.mkd
168
169
  - Gemfile
169
170
  - LICENSE
@@ -192,13 +193,12 @@ files:
192
193
  - docker/Gemfile
193
194
  - docker/Makefile
194
195
  - docker/README.md
195
- - docker/ci/build.ps1
196
196
  - docker/distelli-manifest.yml
197
197
  - docker/r10k/Dockerfile
198
198
  - docker/r10k/docker-entrypoint.d/10-analytics.sh
199
199
  - docker/r10k/docker-entrypoint.sh
200
- - docker/r10k/spec/dockerfile_spec.rb
201
- - docker/r10k/spec/fixtures/Puppetfile
200
+ - docker/spec/dockerfile_spec.rb
201
+ - docker/spec/fixtures/Puppetfile
202
202
  - integration/Gemfile
203
203
  - integration/README.mkd
204
204
  - integration/Rakefile
@@ -234,7 +234,6 @@ files:
234
234
  - integration/tests/Puppetfile/HTTP_PROXY_affects_git_source.rb
235
235
  - integration/tests/README.mkd
236
236
  - integration/tests/basic_functionality/install_pe_only_module_with_puppetfile.rb
237
- - integration/tests/basic_functionality/negative/attempt_to_install_peonly_module_without_license.rb
238
237
  - integration/tests/basic_functionality/negative/neg_deploy_with_invalid_r10k_yaml.rb
239
238
  - integration/tests/basic_functionality/negative/neg_deploy_with_missing_r10k_yaml.rb
240
239
  - integration/tests/basic_functionality/negative/neg_invalid_git_provider.rb
@@ -410,6 +409,7 @@ files:
410
409
  - spec/fixtures/unit/action/r10k_generate_types.yaml
411
410
  - spec/fixtures/unit/action/r10k_puppet_path.yaml
412
411
  - spec/fixtures/unit/puppetfile/argument-error/Puppetfile
412
+ - spec/fixtures/unit/puppetfile/default-branch-override/Puppetfile
413
413
  - spec/fixtures/unit/puppetfile/duplicate-module-error/Puppetfile
414
414
  - spec/fixtures/unit/puppetfile/invalid-syntax/Puppetfile
415
415
  - spec/fixtures/unit/puppetfile/load-error/Puppetfile
data/docker/ci/build.ps1 DELETED
@@ -1,108 +0,0 @@
1
- $ErrorActionPreference = 'Stop'
2
-
3
- function Get-CurrentDirectory
4
- {
5
- $thisName = $MyInvocation.MyCommand.Name
6
- [IO.Path]::GetDirectoryName((Get-Content function:$thisName).File)
7
- }
8
-
9
- function Get-ContainerVersion
10
- {
11
- # shallow repositories need to pull remaining code to `git describe` correctly
12
- if (Test-Path "$(git rev-parse --git-dir)/shallow")
13
- {
14
- git pull --unshallow
15
- }
16
-
17
- # tags required for versioning
18
- git fetch origin 'refs/tags/*:refs/tags/*'
19
- (git describe) -replace '-.*', ''
20
- }
21
-
22
- function Lint-Dockerfile($Path)
23
- {
24
- hadolint --ignore DL3008 --ignore DL3018 --ignore DL4000 --ignore DL4001 $Path
25
- }
26
-
27
- function Build-Container(
28
- $Namespace = 'puppet',
29
- $Version = (Get-ContainerVersion),
30
- $Vcs_ref = $(git rev-parse HEAD))
31
- {
32
- Push-Location (Join-Path (Get-CurrentDirectory) '..')
33
-
34
- $build_date = (Get-Date).ToUniversalTime().ToString('o')
35
- $docker_args = @(
36
- '--pull',
37
- '--build-arg', "vcs_ref=$Vcs_ref",
38
- '--build-arg', "build_date=$build_date",
39
- '--build-arg', "version=$Version",
40
- '--file', "r10k/Dockerfile",
41
- '--tag', "$Namespace/r10k:$Version"
42
- )
43
-
44
- docker build $docker_args r10k
45
-
46
- Pop-Location
47
- }
48
-
49
- function Invoke-ContainerTest(
50
- $Namespace = 'puppet',
51
- $Version = (Get-ContainerVersion))
52
- {
53
- Push-Location (Join-Path (Get-CurrentDirectory) '..')
54
-
55
- bundle install --path .bundle/gems
56
- $ENV:PUPPET_TEST_DOCKER_IMAGE = "$Namespace/r10k:$Version"
57
- Write-Host "Testing against image: ${ENV:PUPPET_TEST_DOCKER_IMAGE}"
58
- bundle exec rspec --version
59
- bundle exec rspec r10k/spec
60
-
61
- Pop-Location
62
- }
63
-
64
- # removes temporary layers / containers / images used during builds
65
- # removes $Namespace/$Name images > 14 days old by default
66
- function Clear-ContainerBuilds(
67
- $Namespace = 'puppet',
68
- $Name,
69
- $OlderThan = [DateTime]::Now.Subtract([TimeSpan]::FromDays(14))
70
- )
71
- {
72
- Write-Output 'Pruning Containers'
73
- docker container prune --force
74
-
75
- # this provides example data which ConvertFrom-String infers parsing structure with
76
- $template = @'
77
- {Version*:10.2.3*} {ID:5b84704c1d01} {[DateTime]Created:2019-02-07 18:24:51} +0000 GMT
78
- {Version*:latest} {ID:0123456789ab} {[DateTime]Created:2019-01-29 00:05:33} +0000 GMT
79
- '@
80
- $output = docker images --filter=reference="$Namespace/${Name}" --format "{{.Tag}} {{.ID}} {{.CreatedAt}}"
81
- Write-Output @"
82
-
83
- Found $Namespace/${Name} images:
84
- $($output | Out-String)
85
-
86
- "@
87
-
88
- if ($output -eq $null) { return }
89
-
90
- Write-Output "Filtering removal candidates..."
91
- # docker image prune supports filter until= but not repository like 'puppetlabs/foo'
92
- # must use label= style filtering which is a bit more inconvenient
93
- # that output is also not user-friendly!
94
- # engine doesn't maintain "last used" or "last pulled" metadata, which would be more useful
95
- # https://github.com/moby/moby/issues/4237
96
- $output |
97
- ConvertFrom-String -TemplateContent $template |
98
- ? { $_.Created -lt $OlderThan } |
99
- # ensure 'latest' are listed first
100
- Sort-Object -Property Version -Descending |
101
- % {
102
- Write-Output "Removing Old $Namespace/${Name} Image $($_.Version) ($($_.ID)) Created On $($_.Created)"
103
- docker image rm $_.ID
104
- }
105
-
106
- Write-Output "`nPruning Dangling Images"
107
- docker image prune --filter "dangling=true" --force
108
- }
@@ -1,71 +0,0 @@
1
- require 'git_utils'
2
- require 'r10k_utils'
3
- require 'master_manipulator'
4
- test_name 'RK-158 - C92361 - Attempt to install a PE-only module with no license file'
5
-
6
- #Init
7
- env_path = on(master, puppet('config print environmentpath')).stdout.rstrip
8
- r10k_fqp = get_r10k_fqp(master)
9
- master_certname = on(master, puppet('config', 'print', 'certname')).stdout.rstrip
10
-
11
- git_repo_path = '/git_repos'
12
- git_repo_name = 'environments'
13
- git_control_remote = File.join(git_repo_path, "#{git_repo_name}.git")
14
- git_environments_path = '/root/environments'
15
- last_commit = git_last_commit(master, git_environments_path)
16
- git_provider = ENV['GIT_PROVIDER'] || 'shellgit'
17
-
18
- r10k_config_path = get_r10k_config_file_path(master)
19
- r10k_config_bak_path = "#{r10k_config_path}.bak"
20
-
21
- #In-line files
22
- r10k_conf = <<-CONF
23
- cachedir: '/var/cache/r10k'
24
- git:
25
- provider: '#{git_provider}'
26
- sources:
27
- control:
28
- basedir: "#{env_path}"
29
- remote: "#{git_control_remote}"
30
- CONF
31
-
32
- #Manifest
33
- site_pp_path = File.join(git_environments_path, 'manifests', 'site.pp')
34
- site_pp = create_site_pp(master_certname, ' include peonly')
35
-
36
- # Verification
37
- error_message_regex = /You must have a valid Puppet Enterprise® license on this node in order to download ztr-peonly/
38
-
39
- #Teardown
40
- teardown do
41
- step 'Restore Original "r10k" Config'
42
- on(master, "mv #{r10k_config_bak_path} #{r10k_config_path}")
43
-
44
- step 'cleanup r10k'
45
- clean_up_r10k(master, last_commit, git_environments_path)
46
- end
47
-
48
- #Setup
49
- step 'Stub the forge'
50
- stub_forge_on(master)
51
-
52
- step 'Backup a Valid "r10k" Config'
53
- on(master, "mv #{r10k_config_path} #{r10k_config_bak_path}")
54
-
55
- step 'Update the "r10k" Config'
56
- create_remote_file(master, r10k_config_path, r10k_conf)
57
-
58
- step 'Inject New "site.pp" to the "production" Environment'
59
- inject_site_pp(master, site_pp_path, site_pp)
60
-
61
- step 'Copy Puppetfile to "production" Environment Git Repo'
62
- create_remote_file(master, "#{git_environments_path}/Puppetfile", 'mod "ztr-peonly"')
63
-
64
- step 'Push Changes'
65
- git_add_commit_push(master, 'production', 'add Puppetfile', git_environments_path)
66
-
67
- #Test
68
- step 'Deploy "production" Environment via r10k'
69
- on(master, "#{r10k_fqp} deploy environment -p", :acceptable_exit_codes => [0,1]) do |result|
70
- assert_match(error_message_regex, result.stderr, 'Expected error message was not observed!')
71
- end