beaker-puppet 1.22.2 → 1.23.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 34853498fbc2455c514d98b08ca269ca9e72d393cb0c4f65fe6c330b50b201a6
4
- data.tar.gz: efc883d575d5a87358da4f16f77245a3785e5a1f646a949a0c8935f175027699
3
+ metadata.gz: 291be3169160fb05d4e9e03f4e18e0d70baa030bee8310919674cc2efb1939bb
4
+ data.tar.gz: 2db7eda8598a998fba05334c49239a2f3491773dc85b56e02f690e7ed3713439
5
5
  SHA512:
6
- metadata.gz: f4898dbb5c44ec8cbab0ee7d5cbb506bac7a683dcdf8a02af6b4b453ddd78555ab88e351428b997fa72a67b6f782f1488e93fdf9dbe7a4890302698d79e6e5ae
7
- data.tar.gz: 8f1f91a863822aaaa7fe2bea97f9714cbfa9d0fb35c5d4376fdf749513193ca8868a894e199c28c9d102f06b77088ec1c83bbcc8f8b39b936ff21b0ee81ff0fa
6
+ metadata.gz: c9a231d1ecbfd9935b75e81f792c168cb7069086a1aecdff9bb059c9ff0b1031160316b7cb8fe54575f314334ed8b4d893ab2558560c66b77567836370a4909e
7
+ data.tar.gz: dd4f7ebe572dc4436bd758ad48e695c287a4b00fdf7074740c251bf9a3cc5f935a9779c3b3aef4b576aa1cef640f9d80a24911538cbc151d85ec3a54a0667b75
data/CHANGELOG.md CHANGED
@@ -2,6 +2,19 @@
2
2
 
3
3
  All notable changes to this project will be documented in this file.
4
4
 
5
+ ## [1.23.0](https://github.com/voxpupuli/beaker-puppet/tree/1.23.0) (2022-02-23)
6
+
7
+ [Full Changelog](https://github.com/voxpupuli/beaker-puppet/compare/1.22.2...1.23.0)
8
+
9
+ **Implemented enhancements:**
10
+
11
+ - \(maint\) Follow redirects when curling MSI [\#176](https://github.com/voxpupuli/beaker-puppet/pull/176) ([joshcooper](https://github.com/joshcooper))
12
+ - Update agent download from URL logic to handle redirects [\#173](https://github.com/voxpupuli/beaker-puppet/pull/173) ([cthorn42](https://github.com/cthorn42))
13
+
14
+ **Merged pull requests:**
15
+
16
+ - Update specs to fix ruby 3 spec failures [\#174](https://github.com/voxpupuli/beaker-puppet/pull/174) ([cthorn42](https://github.com/cthorn42))
17
+
5
18
  ## [1.22.2](https://github.com/voxpupuli/beaker-puppet/tree/1.22.2) (2021-12-31)
6
19
 
7
20
  [Full Changelog](https://github.com/voxpupuli/beaker-puppet/compare/1.22.1...1.22.2)
@@ -75,7 +75,7 @@ module Beaker
75
75
  # redhat-8-arm64 is provided from amazon
76
76
  return true if host.host_hash[:template] == 'redhat-8-arm64' && host.hostname =~ /.puppet.net$/
77
77
 
78
- result = on(host, %(curl -fI "#{url}"), accept_all_exit_codes: true)
78
+ result = on(host, %(curl --location -fI "#{url}"), accept_all_exit_codes: true)
79
79
  return result.exit_code.zero?
80
80
  end
81
81
 
@@ -681,7 +681,7 @@ module Beaker
681
681
  if host.is_cygwin?
682
682
  # NOTE: it is critical that -o be before -O on Windows
683
683
  proxy = opts[:package_proxy] ? "-x #{opts[:package_proxy]} " : ''
684
- on host, "curl #{proxy}-o \"#{msi_download_path}\" -O #{link}"
684
+ on host, "curl #{proxy}--location --output \"#{msi_download_path}\" --remote-name #{link}"
685
685
 
686
686
  #Because the msi installer doesn't add Puppet to the environment path
687
687
  #Add both potential paths for simplicity
@@ -761,9 +761,9 @@ module Beaker
761
761
  raise "You need to specify versions for OSX host\n eg. install_puppet({:version => '3.6.2',:facter_version => '2.1.0',:hiera_version => '1.3.4',})"
762
762
  end
763
763
 
764
- on host, "curl -O #{opts[:mac_download_url]}/puppet-#{puppet_ver}.dmg"
765
- on host, "curl -O #{opts[:mac_download_url]}/facter-#{facter_ver}.dmg"
766
- on host, "curl -O #{opts[:mac_download_url]}/hiera-#{hiera_ver}.dmg"
764
+ on host, "curl --location --remote-name #{opts[:mac_download_url]}/puppet-#{puppet_ver}.dmg"
765
+ on host, "curl --location --remote-name #{opts[:mac_download_url]}/facter-#{facter_ver}.dmg"
766
+ on host, "curl --location --remote-name #{opts[:mac_download_url]}/hiera-#{hiera_ver}.dmg"
767
767
 
768
768
  host.install_package("puppet-#{puppet_ver}")
769
769
  host.install_package("facter-#{facter_ver}")
@@ -815,7 +815,7 @@ module Beaker
815
815
 
816
816
  pkg_name = "puppet-agent-#{agent_version}*"
817
817
  dmg_name = "puppet-agent-#{agent_version}-1.osx#{version}.dmg"
818
- on host, "curl -O #{download_url}/#{dmg_name}"
818
+ on host, "curl --location --remote-name #{download_url}/#{dmg_name}"
819
819
 
820
820
  host.install_package(pkg_name)
821
821
 
@@ -826,7 +826,7 @@ module Beaker
826
826
  # Returns the latest puppet-agent version number from a given url.
827
827
  #
828
828
  # @param [String] url URL containing list of puppet-agent packages.
829
- # Example: https://downloads.puppetlabs.com/mac/10.11/PC1/x86_64
829
+ # Example: https://downloads.puppetlabs.com/mac/puppet7/10.15/x86_64/
830
830
  #
831
831
  # @return [String] version puppet-agent version number (e.g. 1.4.1)
832
832
  # Empty string if none found.
@@ -834,8 +834,20 @@ module Beaker
834
834
  def get_latest_puppet_agent_build_from_url(url)
835
835
  require 'oga'
836
836
  require 'net/http'
837
- body = Net::HTTP.get(URI.parse("#{url}/index_by_lastModified_reverse.html"))
838
- document = Oga.parse_html(body)
837
+
838
+ full_url = "#{url}/index_by_lastModified_reverse.html"
839
+ response = Net::HTTP.get_response(URI(full_url))
840
+ counter = 0
841
+
842
+ # Redirect following
843
+ while response.is_a?(Net::HTTPRedirection) && counter < 15
844
+ response = Net::HTTP.get_response(URI.parse(Net::HTTP.get_response(URI(full_url))['location']))
845
+ counter = counter + 1
846
+ end
847
+
848
+ raise "The URL for puppet-agent download, #{response.uri}, returned #{response.message} with #{response.code}" unless response.is_a?(Net::HTTPSuccess)
849
+
850
+ document = Oga.parse_html(response.body)
839
851
  agents = document.xpath('//a[contains(@href, "puppet-agent")]')
840
852
 
841
853
  latest_match = agents.shift.attributes[0].value
@@ -1,3 +1,3 @@
1
1
  module BeakerPuppet
2
- VERSION = '1.22.2'
2
+ VERSION = '1.23.0'
3
3
  end
@@ -174,7 +174,7 @@ describe ClassMixedWithDSLHelpers do
174
174
 
175
175
  expect( subject ).to receive( :on ).
176
176
  with( agent, 'puppet_command',
177
- :acceptable_exit_codes => [0] )
177
+ {:acceptable_exit_codes => [0]} )
178
178
 
179
179
  subject.apply_manifest_on( agent, 'class { "boo": }')
180
180
  end
@@ -189,7 +189,7 @@ describe ClassMixedWithDSLHelpers do
189
189
  and_return( 'puppet_command' )
190
190
 
191
191
  expect( subject ).to receive( :on ).
192
- with( host, 'puppet_command', :acceptable_exit_codes => [0] )
192
+ with( host, 'puppet_command', {:acceptable_exit_codes => [0]} )
193
193
  end
194
194
 
195
195
  result = subject.apply_manifest_on( the_hosts, 'include foobar' )
@@ -209,7 +209,7 @@ describe ClassMixedWithDSLHelpers do
209
209
  and_return( 'puppet_command' )
210
210
  the_hosts.each do |host|
211
211
  allow( subject ).to receive( :on ).
212
- with( host, 'puppet_command', :acceptable_exit_codes => [0] )
212
+ with( host, 'puppet_command', {:acceptable_exit_codes => [0]} )
213
213
  end
214
214
 
215
215
  result = nil
@@ -228,11 +228,11 @@ describe ClassMixedWithDSLHelpers do
228
228
  and_return( 'puppet_command' )
229
229
  the_hosts.each do |host|
230
230
  allow( subject ).to receive( :on ).
231
- with( host, 'puppet_command', :acceptable_exit_codes => [0] )
231
+ with( host, 'puppet_command', {:acceptable_exit_codes => [0]} )
232
232
  end
233
233
  expect( subject ).to receive( :block_on ).with(
234
234
  anything,
235
- :run_in_parallel => true
235
+ {:run_in_parallel => true}
236
236
  )
237
237
 
238
238
  subject.apply_manifest_on( the_hosts, 'include foobar', { :run_in_parallel => true } )
@@ -246,11 +246,11 @@ describe ClassMixedWithDSLHelpers do
246
246
 
247
247
  expect( subject ).to receive( :on ).
248
248
  with( agent, 'puppet_command',
249
- :acceptable_exit_codes => [0,2] )
249
+ {:acceptable_exit_codes => [0,2]} )
250
250
 
251
251
  subject.apply_manifest_on( agent,
252
252
  'class { "boo": }',
253
- :catch_failures => true )
253
+ {:catch_failures => true} )
254
254
  end
255
255
  it 'allows acceptable exit codes through :catch_failures' do
256
256
  allow( subject ).to receive( :hosts ).and_return( hosts )
@@ -260,12 +260,12 @@ describe ClassMixedWithDSLHelpers do
260
260
 
261
261
  expect( subject ).to receive( :on ).
262
262
  with( agent, 'puppet_command',
263
- :acceptable_exit_codes => [4,0,2] )
263
+ {:acceptable_exit_codes => [4,0,2]} )
264
264
 
265
265
  subject.apply_manifest_on( agent,
266
266
  'class { "boo": }',
267
- :acceptable_exit_codes => [4],
268
- :catch_failures => true )
267
+ {:acceptable_exit_codes => [4],
268
+ :catch_failures => true} )
269
269
  end
270
270
  it 'enforces a 0 exit code through :catch_changes' do
271
271
  allow( subject ).to receive( :hosts ).and_return( hosts )
@@ -276,13 +276,13 @@ describe ClassMixedWithDSLHelpers do
276
276
  expect( subject ).to receive( :on ).with(
277
277
  agent,
278
278
  'puppet_command',
279
- :acceptable_exit_codes => [0]
279
+ {:acceptable_exit_codes => [0]}
280
280
  )
281
281
 
282
282
  subject.apply_manifest_on(
283
283
  agent,
284
284
  'class { "boo": }',
285
- :catch_changes => true
285
+ {:catch_changes => true}
286
286
  )
287
287
  end
288
288
  it 'enforces a 2 exit code through :expect_changes' do
@@ -294,13 +294,13 @@ describe ClassMixedWithDSLHelpers do
294
294
  expect( subject ).to receive( :on ).with(
295
295
  agent,
296
296
  'puppet_command',
297
- :acceptable_exit_codes => [2]
297
+ {:acceptable_exit_codes => [2]}
298
298
  )
299
299
 
300
300
  subject.apply_manifest_on(
301
301
  agent,
302
302
  'class { "boo": }',
303
- :expect_changes => true
303
+ {:expect_changes => true}
304
304
  )
305
305
  end
306
306
  it 'enforces exit codes through :expect_failures' do
@@ -312,13 +312,13 @@ describe ClassMixedWithDSLHelpers do
312
312
  expect( subject ).to receive( :on ).with(
313
313
  agent,
314
314
  'puppet_command',
315
- :acceptable_exit_codes => [1,4,6]
315
+ {:acceptable_exit_codes => [1,4,6]}
316
316
  )
317
317
 
318
318
  subject.apply_manifest_on(
319
319
  agent,
320
320
  'class { "boo": }',
321
- :expect_failures => true
321
+ {:expect_failures => true}
322
322
  )
323
323
  end
324
324
  it 'enforces exit codes through :expect_failures' do
@@ -341,14 +341,14 @@ describe ClassMixedWithDSLHelpers do
341
341
  expect( subject ).to receive( :on ).with(
342
342
  agent,
343
343
  'puppet_command',
344
- :acceptable_exit_codes => [1,2,3,4,5,6]
344
+ {:acceptable_exit_codes => [1,2,3,4,5,6]}
345
345
  )
346
346
 
347
347
  subject.apply_manifest_on(
348
348
  agent,
349
349
  'class { "boo": }',
350
- :acceptable_exit_codes => (1..5),
351
- :expect_failures => true
350
+ {:acceptable_exit_codes => (1..5),
351
+ :expect_failures => true}
352
352
  )
353
353
  end
354
354
 
@@ -341,7 +341,7 @@ describe ClassMixedWithDSLInstallUtils do
341
341
 
342
342
  it 'installs puppet on cygwin windows' do
343
343
  allow(subject).to receive(:link_exists?).and_return( true )
344
- expect(subject).to receive(:on).with(winhost, "curl -o \"#{win_temp}\\puppet-3.7.1-x64.msi\" -O http://downloads.puppet.com/windows/puppet-3.7.1-x64.msi")
344
+ expect(subject).to receive(:on).with(winhost, "curl --location --output \"#{win_temp}\\puppet-3.7.1-x64.msi\" --remote-name http://downloads.puppet.com/windows/puppet-3.7.1-x64.msi")
345
345
  expect(subject).to receive(:on).with(winhost, " echo 'export PATH=$PATH:\"/cygdrive/c/Program Files (x86)/Puppet Labs/Puppet/bin\":\"/cygdrive/c/Program Files/Puppet Labs/Puppet/bin\"' > /etc/bash.bashrc ")
346
346
  expect(subject).to receive(:install_msi_on).with(winhost, "#{win_temp}\\puppet-3.7.1-x64.msi", {}, {:debug => nil})
347
347
 
@@ -350,7 +350,7 @@ describe ClassMixedWithDSLInstallUtils do
350
350
 
351
351
  it 'installs puppet on cygwin windows via proxy' do
352
352
  allow(subject).to receive(:link_exists?).and_return( true )
353
- expect(subject).to receive(:on).with(winhost, "curl -x https://proxy.com -o \"#{win_temp}\\puppet-3.7.1-x64.msi\" -O http://downloads.puppet.com/windows/puppet-3.7.1-x64.msi")
353
+ expect(subject).to receive(:on).with(winhost, "curl -x https://proxy.com --location --output \"#{win_temp}\\puppet-3.7.1-x64.msi\" --remote-name http://downloads.puppet.com/windows/puppet-3.7.1-x64.msi")
354
354
  expect(subject).to receive(:on).with(winhost, " echo 'export PATH=$PATH:\"/cygdrive/c/Program Files (x86)/Puppet Labs/Puppet/bin\":\"/cygdrive/c/Program Files/Puppet Labs/Puppet/bin\"' > /etc/bash.bashrc ")
355
355
  expect(subject).to receive(:install_msi_on).with(winhost, "#{win_temp}\\puppet-3.7.1-x64.msi", {}, {:debug => nil})
356
356
 
@@ -99,7 +99,7 @@ describe ClassMixedWithDSLInstallUtils do
99
99
  expect_version_log_called
100
100
  expect( subject ).to receive( :create_install_msi_batch_on ).with(
101
101
  anything, anything,
102
- 'PUPPET_AGENT_STARTUP_MODE' => 'Manual')
102
+ {'PUPPET_AGENT_STARTUP_MODE' => 'Manual'})
103
103
  subject.install_msi_on(hosts, msi_path, {})
104
104
  end
105
105
 
@@ -112,7 +112,7 @@ describe ClassMixedWithDSLInstallUtils do
112
112
  value = 'Automatic'
113
113
  expect( subject ).to receive( :create_install_msi_batch_on ).with(
114
114
  anything, anything,
115
- 'PUPPET_AGENT_STARTUP_MODE' => value)
115
+ {'PUPPET_AGENT_STARTUP_MODE' => value})
116
116
  subject.install_msi_on(hosts, msi_path, {'PUPPET_AGENT_STARTUP_MODE' => value})
117
117
  end
118
118
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: beaker-puppet
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.22.2
4
+ version: 1.23.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Vox Pupuli
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-12-31 00:00:00.000000000 Z
11
+ date: 2022-02-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rspec