beaker-pe 2.11.24 → 2.13.0

Sign up to get free protection for your applications and to get access to all the features.
data/CODEOWNERS CHANGED
@@ -1,2 +1,2 @@
1
- #This Repository is maintained by the release engineering, skeletor, and nimbus teams
2
- * @puppetlabs/release-engineering @puppetlabs/skeletor @puppetlabs/nimbus
1
+ #This Repository is maintained by the release engineering, dumpling, skeletor, and nimbus teams
2
+ * @puppetlabs/release-engineering @puppetlabs/dumpling @puppetlabs/skeletor @puppetlabs/nimbus
data/Gemfile.lock ADDED
@@ -0,0 +1,215 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ beaker-pe (2.13.0)
5
+ beaker (>= 4.0, < 6)
6
+ beaker-abs
7
+ beaker-answers (~> 0.0)
8
+ beaker-puppet (>= 1, < 3)
9
+ beaker-vmpooler (~> 1.0)
10
+ stringify-hash (~> 0.0.0)
11
+
12
+ GEM
13
+ remote: https://rubygems.org/
14
+ specs:
15
+ activesupport (7.0.4.3)
16
+ concurrent-ruby (~> 1.0, >= 1.0.2)
17
+ i18n (>= 1.6, < 2)
18
+ minitest (>= 5.1)
19
+ tzinfo (~> 2.0)
20
+ ansi (1.5.0)
21
+ ast (2.4.2)
22
+ bcrypt_pbkdf (1.1.0)
23
+ beaker (4.40.1)
24
+ beaker-hostgenerator
25
+ ed25519 (~> 1.0)
26
+ hocon (~> 1.0)
27
+ in-parallel (>= 0.1, < 2)
28
+ inifile (~> 3.0)
29
+ minitar (~> 0.6)
30
+ minitest (~> 5.4)
31
+ net-scp (>= 1.2, < 5.0)
32
+ net-ssh (>= 5.0)
33
+ rexml
34
+ rsync (~> 1.0.9)
35
+ stringify-hash (~> 0.0)
36
+ thor (>= 1.0.1, < 2.0)
37
+ beaker-abs (0.11.0)
38
+ bcrypt_pbkdf (>= 1.0, < 2.0)
39
+ beaker (~> 4.0)
40
+ ed25519 (>= 1.2, < 2.0)
41
+ vmfloaty (>= 1.0, < 2)
42
+ beaker-answers (0.29.0)
43
+ hocon (~> 1.0)
44
+ require_all (>= 1.3.2, < 3.1.0)
45
+ stringify-hash (~> 0.0.0)
46
+ beaker-hostgenerator (2.2.0)
47
+ deep_merge (~> 1.0)
48
+ beaker-puppet (2.0.0)
49
+ beaker (~> 4.1)
50
+ oga (~> 3.4)
51
+ beaker-vmpooler (1.4.0)
52
+ stringify-hash (~> 0.0.0)
53
+ coderay (1.1.3)
54
+ commander (4.6.0)
55
+ highline (~> 2.0.0)
56
+ concurrent-ruby (1.2.2)
57
+ daemons (1.4.1)
58
+ deep_merge (1.2.2)
59
+ diff-lcs (1.5.0)
60
+ docile (1.4.0)
61
+ domain_name (0.5.20190701)
62
+ unf (>= 0.0.5, < 1.0.0)
63
+ ed25519 (1.3.0)
64
+ eventmachine (1.2.7)
65
+ fakefs (2.4.0)
66
+ faraday (1.10.3)
67
+ faraday-em_http (~> 1.0)
68
+ faraday-em_synchrony (~> 1.0)
69
+ faraday-excon (~> 1.1)
70
+ faraday-httpclient (~> 1.0)
71
+ faraday-multipart (~> 1.0)
72
+ faraday-net_http (~> 1.0)
73
+ faraday-net_http_persistent (~> 1.0)
74
+ faraday-patron (~> 1.0)
75
+ faraday-rack (~> 1.0)
76
+ faraday-retry (~> 1.0)
77
+ ruby2_keywords (>= 0.0.4)
78
+ faraday-cookie_jar (0.0.7)
79
+ faraday (>= 0.8.0)
80
+ http-cookie (~> 1.0.0)
81
+ faraday-em_http (1.0.0)
82
+ faraday-em_synchrony (1.0.0)
83
+ faraday-excon (1.1.0)
84
+ faraday-httpclient (1.0.1)
85
+ faraday-multipart (1.0.4)
86
+ multipart-post (~> 2)
87
+ faraday-net_http (1.0.1)
88
+ faraday-net_http_persistent (1.2.0)
89
+ faraday-patron (1.0.0)
90
+ faraday-rack (1.0.0)
91
+ faraday-retry (1.0.3)
92
+ faraday_middleware (1.2.0)
93
+ faraday (~> 1.0)
94
+ highline (2.0.3)
95
+ hocon (1.4.0)
96
+ http-cookie (1.0.5)
97
+ domain_name (~> 0.5)
98
+ i18n (1.13.0)
99
+ concurrent-ruby (~> 1.0)
100
+ in-parallel (1.0.0)
101
+ inifile (3.0.0)
102
+ iniparser (1.0.1)
103
+ json (2.6.3)
104
+ kramdown (2.4.0)
105
+ rexml
106
+ logutils (0.6.1)
107
+ markdown (1.2.0)
108
+ kramdown (>= 1.5.0)
109
+ props (>= 1.1.2)
110
+ textutils (>= 0.10.0)
111
+ method_source (1.0.0)
112
+ minitar (0.9)
113
+ minitest (5.18.0)
114
+ multipart-post (2.3.0)
115
+ net-ldap (0.16.3)
116
+ net-scp (4.0.0)
117
+ net-ssh (>= 2.6.5, < 8.0.0)
118
+ net-ssh (7.1.0)
119
+ oga (3.4)
120
+ ast
121
+ ruby-ll (~> 2.1)
122
+ power_assert (2.0.3)
123
+ props (1.2.0)
124
+ iniparser (>= 0.1.0)
125
+ pry (0.14.2)
126
+ coderay (~> 1.1)
127
+ method_source (~> 1.0)
128
+ rack (2.2.7)
129
+ rake (13.0.6)
130
+ require_all (3.0.0)
131
+ rexml (3.2.5)
132
+ rspec (3.12.0)
133
+ rspec-core (~> 3.12.0)
134
+ rspec-expectations (~> 3.12.0)
135
+ rspec-mocks (~> 3.12.0)
136
+ rspec-core (3.12.2)
137
+ rspec-support (~> 3.12.0)
138
+ rspec-expectations (3.12.3)
139
+ diff-lcs (>= 1.2.0, < 2.0)
140
+ rspec-support (~> 3.12.0)
141
+ rspec-its (1.3.0)
142
+ rspec-core (>= 3.0.0)
143
+ rspec-expectations (>= 3.0.0)
144
+ rspec-mocks (3.12.5)
145
+ diff-lcs (>= 1.2.0, < 2.0)
146
+ rspec-support (~> 3.12.0)
147
+ rspec-support (3.12.0)
148
+ rsync (1.0.9)
149
+ ruby-ll (2.1.2)
150
+ ansi
151
+ ast
152
+ ruby2_keywords (0.0.5)
153
+ rubyzip (2.3.2)
154
+ scooter (4.4.0)
155
+ beaker (~> 4.0)
156
+ faraday (~> 1.5)
157
+ faraday-cookie_jar (~> 0.0, >= 0.0.7)
158
+ faraday_middleware (~> 1.2)
159
+ json (>= 2.3.0)
160
+ net-ldap (~> 0.16.0)
161
+ test-unit
162
+ simplecov (0.22.0)
163
+ docile (~> 1.1)
164
+ simplecov-html (~> 0.11)
165
+ simplecov_json_formatter (~> 0.1)
166
+ simplecov-html (0.12.3)
167
+ simplecov_json_formatter (0.1.4)
168
+ stringify-hash (0.0.2)
169
+ test-unit (3.5.7)
170
+ power_assert
171
+ textutils (1.4.0)
172
+ activesupport
173
+ logutils (>= 0.6.1)
174
+ props (>= 1.1.2)
175
+ rubyzip (>= 1.0.0)
176
+ thin (1.8.2)
177
+ daemons (~> 1.0, >= 1.0.9)
178
+ eventmachine (~> 1.0, >= 1.0.4)
179
+ rack (>= 1, < 3)
180
+ thor (1.2.2)
181
+ tzinfo (2.0.6)
182
+ concurrent-ruby (~> 1.0)
183
+ unf (0.1.4)
184
+ unf_ext
185
+ unf_ext (0.0.8.2)
186
+ vmfloaty (1.8.0)
187
+ commander (>= 4.4.3, < 4.7.0)
188
+ faraday (~> 1.5, >= 1.5.1)
189
+ yard (0.9.34)
190
+
191
+ PLATFORMS
192
+ aarch64-linux
193
+ ruby
194
+ x86_64-linux
195
+
196
+ DEPENDENCIES
197
+ activesupport (~> 7.0)
198
+ beaker (~> 4.0)
199
+ beaker-abs (~> 0.8)
200
+ beaker-pe!
201
+ beaker-vmpooler (~> 1.3)
202
+ deep_merge
203
+ fakefs (~> 2.4, < 2.5.0)
204
+ markdown
205
+ pry (~> 0.10)
206
+ rake (~> 13.0.6)
207
+ rspec (~> 3.0)
208
+ rspec-its
209
+ scooter (~> 4.3)
210
+ simplecov (= 0.22.0)
211
+ thin
212
+ yard
213
+
214
+ BUNDLED WITH
215
+ 2.4.18
data/README.md CHANGED
@@ -2,7 +2,17 @@
2
2
 
3
3
  The Puppet Enterprise (PE) Beaker Library
4
4
 
5
- # What is This Thing?
5
+ - [beaker-pe](#beaker-pe)
6
+ - [What is This Thing?](#what-is-this-thing)
7
+ - [Documentation](#documentation)
8
+ - [Upgrading from 0.y to 1.y?](#upgrading-from-0y-to-1y)
9
+ - [Gem Installing](#gem-installing)
10
+ - [Spec Testing](#spec-testing)
11
+ - [Acceptance Testing](#acceptance-testing)
12
+ - [Releasing](#releasing)
13
+ - [Questions](#questions)
14
+
15
+ ## What is This Thing?
6
16
 
7
17
  The PE Beaker library contains all PE-specific
8
18
 
@@ -11,7 +21,7 @@ The PE Beaker library contains all PE-specific
11
21
 
12
22
  that help someone acceptance test PE easier with Beaker.
13
23
 
14
- # Documentation
24
+ ## Documentation
15
25
 
16
26
  - [Rubydocs](http://www.rubydoc.info/github/puppetlabs/beaker-pe) contain the
17
27
  technical reference for APIs and other aspects of beaker-pe. They describe
@@ -21,7 +31,7 @@ of key concepts.
21
31
  involved in addressing key problems and use-cases. For instance, checkout our
22
32
  [How-to Install Puppet Enterprise doc](docs/how_to/install_puppet_enterprise.md).
23
33
 
24
- # Upgrading from 0.y to 1.y?
34
+ ## Upgrading from 0.y to 1.y?
25
35
 
26
36
  If you've used beaker-pe previously (during the 0.y versions), you'll
27
37
  have to change the way that you include beaker-pe for 1.y versions &
@@ -37,46 +47,44 @@ things:
37
47
  2. put a `require 'beaker-pe'` statement in your tests/code that need
38
48
  beaker-pe-specific functionality
39
49
 
40
- # Gem Installing
50
+ ## Gem Installing
51
+
41
52
  Spec tests require a version of scooter that is private. Execute
42
53
  `export GEM_SOURCE=https://artifactory.delivery.puppetlabs.net/artifactory/api/gems/rubygems/` prior to running
43
54
  `bundle install --path .bundle/gems/`.
44
55
 
45
- # Spec Testing
56
+ ## Spec Testing
46
57
 
47
58
  Spec tests all live under the `spec` folder. These are the default rake task, &
48
59
  so can be run with a simple `bundle exec rake`, as well as being fully specified
49
60
  by running `bundle exec rake test:spec:run` or using the `test:spec` task.
50
61
 
51
-
52
62
  There are also code coverage tests built into the template, which can be run
53
63
  with spec testing by running the `test:spec:coverage` rake task.
54
64
 
55
-
56
- ## Acceptance Testing
65
+ ### Acceptance Testing
57
66
 
58
67
  Acceptance tests live in the `acceptance/tests` folder. These are Beaker tests,
59
68
  & are dependent on having Beaker installed. Note that this will happen with a
60
69
  `bundle install` execution, but can be avoided if you're not looking to run
61
70
  acceptance tests by ignoring the `acceptance_testing` gem group.
62
71
 
63
-
64
72
  You can run the acceptance testing suite by invoking the `test:acceptance` rake
65
73
  task. It should be noted that this is a shortcut for the `test:acceptance:quick`
66
74
  task, which is named as such because it uses no pre-suite. This uses a default
67
75
  provided hosts file for acceptance under the `acceptance/config` directory. If
68
76
  you'd like to provide your own hosts file, set the `CONFIG` environment variable.
69
77
 
70
- # Release
78
+ ## Releasing
71
79
 
72
- To release new versions, we use a
73
- [Jenkins job](https://cinext-jenkinsmaster-sre-prod-1.delivery.puppetlabs.net/job/qe_beaker-pe-gem_init-multijob_main/)
74
- (access to internal infrastructure will be required to view job).
80
+ Open a release prep PR and run the release action:
75
81
 
76
- To release a new version (from the main branch), you'll need to just provide
77
- a new beaker-pe version number to the job, and you're off to the races.
82
+ 1. Bump the "version" parameter in `lib/beaker-pe/version.rb` appropriately based merged pull requests since the last release.
83
+ 2. Run `./release-prep` to update `Gemfile.lock` and `CHANGELOG.md`.
84
+ 3. Commit and push changes to a new branch, then open a pull request against `main` and be sure to add the "maintenance" label.
85
+ 4. After the pull request is approved and merged, then navigate to Actions --> Release Action --> run workflow --> Branch: main --> Run workflow.
78
86
 
79
- # Questions
87
+ ## Questions
80
88
 
81
89
  If you have questions, please reach out to our
82
90
  [MAINTAINERS](MAINTAINERS).
@@ -7,11 +7,6 @@ hosts.each do |host|
7
7
  on host, facter('--help')
8
8
  end
9
9
 
10
- step 'puppet install smoketest: verify \'hiera --help\' can be successfully called on all hosts'
11
- hosts.each do |host|
12
- on host, hiera('--help')
13
- end
14
-
15
10
  step 'puppet install smoketest: verify \'puppet help\' can be successfully called on all hosts'
16
11
  hosts.each do |host|
17
12
  on host, puppet('help')
data/beaker-pe.gemspec CHANGED
@@ -20,20 +20,20 @@ Gem::Specification.new do |s|
20
20
  # Testing dependencies
21
21
  s.add_development_dependency 'rspec', '~> 3.0'
22
22
  s.add_development_dependency 'rspec-its'
23
- s.add_development_dependency 'fakefs', '~> 0.6', '< 0.14.0'
24
- s.add_development_dependency 'rake', '~> 12.3.3'
25
- s.add_development_dependency 'simplecov', '= 0.18.5'
23
+ s.add_development_dependency 'fakefs', '~> 2.4', '< 2.5.0'
24
+ s.add_development_dependency 'rake', '~> 13.0.6'
25
+ s.add_development_dependency 'simplecov', '= 0.22.0'
26
26
  s.add_development_dependency 'pry', '~> 0.10'
27
27
 
28
28
  # Documentation dependencies
29
29
  s.add_development_dependency 'yard'
30
30
  s.add_development_dependency 'markdown'
31
- s.add_development_dependency 'activesupport', '~> 5.0'
31
+ s.add_development_dependency 'activesupport', '~> 7.0'
32
32
  s.add_development_dependency 'thin'
33
33
 
34
34
  # Run time dependencies
35
- s.add_runtime_dependency 'beaker', '~>4.0'
36
- s.add_runtime_dependency 'beaker-puppet', '~>1.0'
35
+ s.add_runtime_dependency 'beaker', '>= 4.0', '< 6'
36
+ s.add_runtime_dependency 'beaker-puppet', '>=1', '<3'
37
37
  s.add_runtime_dependency 'stringify-hash', '~> 0.0.0'
38
38
  s.add_runtime_dependency 'beaker-answers', '~> 0.0'
39
39
  s.add_runtime_dependency 'beaker-abs'
@@ -378,8 +378,8 @@ module Beaker
378
378
  local = File.directory?(path)
379
379
  filename = "#{host['dist']}"
380
380
  if local
381
- extension = File.exists?("#{path}/#{filename}.tar.gz") ? ".tar.gz" : ".tar"
382
- if not File.exists?("#{path}/#{filename}#{extension}")
381
+ extension = File.exist?("#{path}/#{filename}.tar.gz") ? ".tar.gz" : ".tar"
382
+ unless File.exist?("#{path}/#{filename}#{extension}")
383
383
  raise "attempting installation on #{host}, #{path}/#{filename}#{extension} does not exist"
384
384
  end
385
385
  scp_to host, "#{path}/#{filename}#{extension}", "#{host['working_dir']}/#{filename}#{extension}"
@@ -404,16 +404,23 @@ module Beaker
404
404
  if host['platform'] =~ /eos/
405
405
  host.get_remote_file("#{path}/#{filename}#{extension}")
406
406
  else
407
- unpack = 'tar -xvf -'
408
- unpack = extension =~ /gz/ ? 'gunzip | ' + unpack : unpack
409
407
  if opts[:fetch_local_then_push_to_host]
410
408
  fetch_and_push_pe(host, path, filename, extension)
411
409
  command_file_push = 'cat '
412
410
  else
413
411
  curlopts = opts[:use_proxy] ? "--proxy #{opts[:proxy_hostname]}:3128 " : ""
414
- command_file_push = "curl -L #{curlopts}#{path}/"
412
+ command_file_push = "curl --fail --location --output #{filename}#{extension} #{curlopts}#{path}/"
415
413
  end
416
- on host, "cd #{host['working_dir']}; #{command_file_push}#{filename}#{extension} | #{unpack}"
414
+
415
+ retry_requirements = {
416
+ desired_exit_codes: [0],
417
+ max_retries: 3,
418
+ verbose: 'true'
419
+ }
420
+ fetch_tarball_command = "cd #{host['working_dir']}; #{command_file_push}#{filename}#{extension}"
421
+ retry_on(host, fetch_tarball_command, retry_requirements)
422
+ on host, "cd #{host['working_dir']}; tar -xvf #{filename}#{extension}"
423
+
417
424
  gpg_key_overwrite(host, 'tarball')
418
425
  end
419
426
  end
@@ -488,9 +495,9 @@ module Beaker
488
495
  # For some platforms (e.g, redhatfips), packaging_platfrom is set and should
489
496
  # be used as the primary source of truth for the platform string.
490
497
  platform = host['packaging_platform'] || host['platform']
491
- # We don't have a separate AIX 7.2 build, so it is
498
+ # We don't have a separate AIX 7.2 build prior to 2023, so it is
492
499
  # classified as 7.1 for pe_repo purposes
493
- if platform == "aix-7.2-power"
500
+ if platform == "aix-7.2-power" && version_is_less(master[:pe_ver], '2023.0.0')
494
501
  platform = "aix-7.1-power"
495
502
  end
496
503
  klass = platform.gsub(/-/, '_').gsub(/\./,'')
@@ -3,7 +3,7 @@ module Beaker
3
3
  module PE
4
4
 
5
5
  module Version
6
- STRING = '2.11.24'
6
+ STRING = '2.13.0'
7
7
  end
8
8
 
9
9
  end
data/release-prep ADDED
@@ -0,0 +1,12 @@
1
+ #!/usr/bin/env bash
2
+
3
+ # bundle install
4
+ docker run -it --rm \
5
+ -v $(pwd):/app \
6
+ ruby:2.7-slim-bullseye \
7
+ /bin/bash -c 'apt-get update -qq && apt-get install -y --no-install-recommends build-essential git make && cd /app && gem install bundler && bundle install --jobs 3; echo "LOCK_FILE_UPDATE_EXIT_CODE=$?"'
8
+
9
+ # Update Changelog
10
+ docker run -it --rm -e CHANGELOG_GITHUB_TOKEN -v $(pwd):/usr/local/src/your-app \
11
+ githubchangeloggenerator/github-changelog-generator:1.16.2 \
12
+ github_changelog_generator --future-release $(grep STRING lib/beaker-pe/version.rb |rev |cut -d "'" -f2 |rev)
@@ -0,0 +1,10 @@
1
+ ---
2
+ HOSTS:
3
+ rocky8-64-1:
4
+ platform: el-8-x86_64
5
+ hypervisor: vmpooler
6
+ template: rocky-8-x86_64-pooled
7
+ roles:
8
+ - agent
9
+ CONFIG:
10
+ pooling_api: 'https://vmpooler-prod.k8s.infracore.puppet.net/api/v3'
@@ -1063,13 +1063,14 @@ describe ClassMixedWithDSLInstallUtils do
1063
1063
  describe 'fetch_pe' do
1064
1064
 
1065
1065
  it 'can push a local PE .tar.gz to a host and unpack it' do
1066
- allow( File ).to receive( :directory? ).and_return( true ) #is local
1067
- allow( File ).to receive( :exists? ).and_return( true ) #is a .tar.gz
1066
+ allow( File ).to receive( :directory? ).and_return( true )
1067
+ allow( File ).to receive( :exists? ).and_return( true )
1068
+ allow( File ).to receive( :exist? ).and_return( true )
1068
1069
  unixhost['pe_dir'] = '/local/file/path'
1069
1070
  allow( subject ).to receive( :scp_to ).and_return( true )
1070
1071
 
1071
1072
  path = unixhost['pe_dir']
1072
- filename = "#{ unixhost['dist'] }"
1073
+ filename = unixhost['dist']
1073
1074
  extension = '.tar.gz'
1074
1075
  expect( subject ).to receive( :scp_to ).with( unixhost, "#{ path }/#{ filename }#{ extension }", "#{ unixhost['working_dir'] }/#{ filename }#{ extension }" ).once
1075
1076
  expect( subject ).to receive( :on ).with( unixhost, /gunzip/ ).once
@@ -1079,61 +1080,69 @@ describe ClassMixedWithDSLInstallUtils do
1079
1080
 
1080
1081
  it 'can download a PE .tar from a URL to a host and unpack it' do
1081
1082
  allow( File ).to receive( :directory? ).and_return( false ) #is not local
1082
- allow( subject ).to receive( :link_exists? ) do |arg|
1083
- if arg =~ /.tar.gz/ #there is no .tar.gz link, only a .tar
1084
- false
1085
- else
1086
- true
1087
- end
1088
- end
1089
- allow( subject ).to receive( :on ).and_return( true )
1083
+ allow( subject ).to receive( :link_exists? ) { |arg| arg !~ /.tar.gz/ }
1084
+ zero_exit_code_mock = Object.new
1085
+ allow(zero_exit_code_mock).to receive(:exit_code).and_return(0)
1086
+ allow( subject ).to receive( :on ).and_return( zero_exit_code_mock )
1090
1087
 
1088
+ unixhost['pe_dir'] = '/local/file/path'
1091
1089
  path = unixhost['pe_dir']
1092
- filename = "#{ unixhost['dist'] }"
1090
+ filename = unixhost['dist']
1093
1091
  extension = '.tar'
1094
- expect( subject ).to receive( :on ).with( unixhost, "cd #{ unixhost['working_dir'] }; curl -L #{ path }/#{ filename }#{ extension } | tar -xvf -" ).once
1092
+ expect( subject )
1093
+ .to receive( :on )
1094
+ .with( unixhost, "cd #{ unixhost['working_dir'] }; curl --fail --location --output #{ filename }#{ extension } #{ path }/#{ filename }#{ extension }", anything ).once
1095
1095
  subject.fetch_pe( [unixhost], {} )
1096
1096
  end
1097
1097
 
1098
1098
  it 'can download a PE .tar from a URL to #fetch_and_push_pe' do
1099
- allow( File ).to receive( :directory? ).and_return( false ) #is not local
1100
- allow( subject ).to receive( :link_exists? ) do |arg|
1101
- if arg =~ /.tar.gz/ #there is no .tar.gz link, only a .tar
1102
- false
1103
- else
1104
- true
1105
- end
1106
- end
1107
- allow( subject ).to receive( :on ).and_return( true )
1099
+ allow( File ).to receive( :directory? ).and_return( false )
1100
+ allow( subject ).to receive( :link_exists? ) { |arg| arg !~ /.tar.gz/ }
1108
1101
 
1109
- filename = "#{ unixhost['dist'] }"
1102
+ zero_exit_code_mock = Object.new
1103
+ allow(zero_exit_code_mock).to receive(:exit_code).and_return(0)
1104
+ allow( subject ).to receive( :on ).and_return( zero_exit_code_mock )
1105
+
1106
+ filename = unixhost['dist']
1110
1107
  extension = '.tar'
1111
- expect( subject ).to receive( :fetch_and_push_pe ).with( unixhost, anything, filename, extension ).once
1112
- expect( subject ).to receive( :on ).with( unixhost, "cd #{ unixhost['working_dir'] }; cat #{ filename }#{ extension } | tar -xvf -" ).once
1108
+ expect( subject )
1109
+ .to receive( :fetch_and_push_pe )
1110
+ .with( unixhost, anything, filename, extension ).once
1111
+ expect( subject )
1112
+ .to receive( :on )
1113
+ .with( unixhost, "cd #{ unixhost['working_dir'] }; cat #{ filename }#{ extension }", anything )
1114
+ .once
1113
1115
  subject.fetch_pe( [unixhost], {:fetch_local_then_push_to_host => true} )
1114
1116
  end
1115
1117
 
1116
1118
  it 'can download a PE .tar.gz from a URL to a host and unpack it' do
1117
1119
  allow( File ).to receive( :directory? ).and_return( false ) #is not local
1118
1120
  allow( subject ).to receive( :link_exists? ).and_return( true ) #is a tar.gz
1119
- allow( subject ).to receive( :on ).and_return( true )
1121
+
1122
+ zero_exit_code_mock = Object.new
1123
+ allow(zero_exit_code_mock).to receive(:exit_code).and_return(0)
1124
+ allow( subject ).to receive( :on ).and_return( zero_exit_code_mock )
1120
1125
 
1121
1126
  path = unixhost['pe_dir']
1122
- filename = "#{ unixhost['dist'] }"
1127
+ filename = unixhost['dist']
1123
1128
  extension = '.tar.gz'
1124
- expect( subject ).to receive( :on ).with( unixhost, "cd #{ unixhost['working_dir'] }; curl -L #{ path }/#{ filename }#{ extension } | gunzip | tar -xvf -" ).once
1129
+ expect( subject )
1130
+ .to receive( :on )
1131
+ .with( unixhost, "cd #{ unixhost['working_dir'] }; curl --fail --location --output #{ filename }#{ extension } #{ path }/#{ filename }#{ extension }", anything ).once
1125
1132
  subject.fetch_pe( [unixhost], {} )
1126
1133
  end
1127
1134
 
1128
1135
  it 'can download a PE .tar.gz from a URL to #fetch_and_push_pe' do
1129
- allow( File ).to receive( :directory? ).and_return( false ) #is not local
1130
- allow( subject ).to receive( :link_exists? ).and_return( true ) #is a tar.gz
1131
- allow( subject ).to receive( :on ).and_return( true )
1136
+ allow( File ).to receive( :directory? ).and_return( false )
1137
+ allow( subject ).to receive( :link_exists? ).and_return( true )
1138
+ zero_exit_code_mock = Object.new
1139
+ allow(zero_exit_code_mock).to receive(:exit_code).and_return(0)
1140
+ allow( subject ).to receive( :on ).and_return( zero_exit_code_mock )
1132
1141
 
1133
- filename = "#{ unixhost['dist'] }"
1142
+ filename = unixhost['dist']
1134
1143
  extension = '.tar.gz'
1135
1144
  expect( subject ).to receive( :fetch_and_push_pe ).with( unixhost, anything, filename, extension ).once
1136
- expect( subject ).to receive( :on ).with( unixhost, "cd #{ unixhost['working_dir'] }; cat #{ filename }#{ extension } | gunzip | tar -xvf -" ).once
1145
+ expect( subject ).to receive( :on ).with( unixhost, "cd #{ unixhost['working_dir'] }; cat #{ filename }#{ extension }", anything ).once
1137
1146
  subject.fetch_pe( [unixhost], {:fetch_local_then_push_to_host => true} )
1138
1147
  end
1139
1148
 
@@ -1367,7 +1376,7 @@ describe ClassMixedWithDSLInstallUtils do
1367
1376
 
1368
1377
  allow(subject).to receive(:stop_agent_on).and_return(true)
1369
1378
  expect(subject).to receive(:stop_agent_on).with([mono_master, pe_postgres], :run_in_parallel => true).once
1370
-
1379
+
1371
1380
  allow(subject).to receive(:on).with(mono_master, "puppet agent -t", :acceptable_exit_codes=>[0, 2]).exactly(3).times
1372
1381
  allow(subject).to receive(:on).with(pe_postgres, "puppet agent -t", :acceptable_exit_codes=> [0, 2]).once
1373
1382