beaker-puppet 1.22.0 → 1.23.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 53f89a92b8bca60e64107cc70882e959fbf05594edf34307374f392b8f31e622
4
- data.tar.gz: a3cd7ac37aa8c519346bd8a2a874f6b42661983bf0f7edad91f53a77b3a646ab
3
+ metadata.gz: 291be3169160fb05d4e9e03f4e18e0d70baa030bee8310919674cc2efb1939bb
4
+ data.tar.gz: 2db7eda8598a998fba05334c49239a2f3491773dc85b56e02f690e7ed3713439
5
5
  SHA512:
6
- metadata.gz: a0a6be8dfcfcb86fb13b1b6833fa18b470769cdd50b6321c51f9aa5a75106eb3cab12f03f98b5f5eb7e4e861e8746041f83eeb2c1d1e8374910f19d96d40de23
7
- data.tar.gz: cbaa76dcb7f841cc0d057b28ae761f820507b74d2dfa7f5f0226990a571ab032f5de12b1b5b59ca6e62e0df41dfb86db007ec81e1fa7b1b835a6f8ce07158b04
6
+ metadata.gz: c9a231d1ecbfd9935b75e81f792c168cb7069086a1aecdff9bb059c9ff0b1031160316b7cb8fe54575f314334ed8b4d893ab2558560c66b77567836370a4909e
7
+ data.tar.gz: dd4f7ebe572dc4436bd758ad48e695c287a4b00fdf7074740c251bf9a3cc5f935a9779c3b3aef4b576aa1cef640f9d80a24911538cbc151d85ec3a54a0667b75
data/CHANGELOG.md CHANGED
@@ -2,9 +2,38 @@
2
2
 
3
3
  All notable changes to this project will be documented in this file.
4
4
 
5
- ## [v1.22.0](https://github.com/voxpupuli/beaker-puppet/tree/v1.22.0) (2021-08-17)
5
+ ## [1.23.0](https://github.com/voxpupuli/beaker-puppet/tree/1.23.0) (2022-02-23)
6
6
 
7
- [Full Changelog](https://github.com/voxpupuli/beaker-puppet/compare/1.21.0...v1.22.0)
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
+
18
+ ## [1.22.2](https://github.com/voxpupuli/beaker-puppet/tree/1.22.2) (2021-12-31)
19
+
20
+ [Full Changelog](https://github.com/voxpupuli/beaker-puppet/compare/1.22.1...1.22.2)
21
+
22
+ **Merged pull requests:**
23
+
24
+ - Fix install\_puppet\_on on el8 [\#170](https://github.com/voxpupuli/beaker-puppet/pull/170) ([gcampbell12](https://github.com/gcampbell12))
25
+
26
+ ## [1.22.1](https://github.com/voxpupuli/beaker-puppet/tree/1.22.1) (2021-08-19)
27
+
28
+ [Full Changelog](https://github.com/voxpupuli/beaker-puppet/compare/1.22.0...1.22.1)
29
+
30
+ **Merged pull requests:**
31
+
32
+ - Revert "Use the built-in Resolv::IPv4::Regex" [\#168](https://github.com/voxpupuli/beaker-puppet/pull/168) ([kenyon](https://github.com/kenyon))
33
+
34
+ ## [1.22.0](https://github.com/voxpupuli/beaker-puppet/tree/1.22.0) (2021-08-17)
35
+
36
+ [Full Changelog](https://github.com/voxpupuli/beaker-puppet/compare/1.21.0...1.22.0)
8
37
 
9
38
  **Implemented enhancements:**
10
39
 
data/Rakefile CHANGED
@@ -306,7 +306,7 @@ begin
306
306
  config.exclude_labels = %w{duplicate question invalid wontfix wont-fix skip-changelog}
307
307
  config.user = 'voxpupuli'
308
308
  config.project = 'beaker-puppet'
309
- config.future_release = "v#{Gem::Specification.load("#{config.project}.gemspec").version}"
309
+ config.future_release = "#{Gem::Specification.load("#{config.project}.gemspec").version}"
310
310
  end
311
311
  rescue LoadError
312
312
  end
@@ -12,7 +12,7 @@ module Beaker
12
12
 
13
13
  # Return the regular expression pattern for an IPv4 address
14
14
  def ipv4_regex
15
- Resolv::IPv4::Regex
15
+ return /(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)/
16
16
  end
17
17
 
18
18
  # Return the IP address that given hostname returns when resolved on
@@ -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
 
@@ -303,12 +303,10 @@ module Beaker
303
303
  # run_in_parallel option includes install
304
304
  run_in_parallel = run_in_parallel? opts, @options, 'install'
305
305
  block_on hosts, { :run_in_parallel => run_in_parallel } do |host|
306
- if host['platform'] =~ /el-(5|6|7)/
307
- relver = $1
308
- install_puppet_from_rpm_on(host, opts.merge(:release => relver, :family => 'el'))
309
- elsif host['platform'] =~ /fedora-(\d+)/
310
- relver = $1
311
- install_puppet_from_rpm_on(host, opts.merge(:release => relver, :family => 'fedora'))
306
+ if host['platform'] =~ /(el|fedora)-(\d+)/
307
+ family = $1
308
+ relver = $2
309
+ install_puppet_from_rpm_on(host, opts.merge(:release => relver, :family => family))
312
310
  elsif host['platform'] =~ /(ubuntu|debian|cumulus|huaweios)/
313
311
  install_puppet_from_deb_on(host, opts)
314
312
  elsif host['platform'] =~ /windows/
@@ -683,7 +681,7 @@ module Beaker
683
681
  if host.is_cygwin?
684
682
  # NOTE: it is critical that -o be before -O on Windows
685
683
  proxy = opts[:package_proxy] ? "-x #{opts[:package_proxy]} " : ''
686
- on host, "curl #{proxy}-o \"#{msi_download_path}\" -O #{link}"
684
+ on host, "curl #{proxy}--location --output \"#{msi_download_path}\" --remote-name #{link}"
687
685
 
688
686
  #Because the msi installer doesn't add Puppet to the environment path
689
687
  #Add both potential paths for simplicity
@@ -763,9 +761,9 @@ module Beaker
763
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',})"
764
762
  end
765
763
 
766
- on host, "curl -O #{opts[:mac_download_url]}/puppet-#{puppet_ver}.dmg"
767
- on host, "curl -O #{opts[:mac_download_url]}/facter-#{facter_ver}.dmg"
768
- 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"
769
767
 
770
768
  host.install_package("puppet-#{puppet_ver}")
771
769
  host.install_package("facter-#{facter_ver}")
@@ -817,7 +815,7 @@ module Beaker
817
815
 
818
816
  pkg_name = "puppet-agent-#{agent_version}*"
819
817
  dmg_name = "puppet-agent-#{agent_version}-1.osx#{version}.dmg"
820
- on host, "curl -O #{download_url}/#{dmg_name}"
818
+ on host, "curl --location --remote-name #{download_url}/#{dmg_name}"
821
819
 
822
820
  host.install_package(pkg_name)
823
821
 
@@ -828,7 +826,7 @@ module Beaker
828
826
  # Returns the latest puppet-agent version number from a given url.
829
827
  #
830
828
  # @param [String] url URL containing list of puppet-agent packages.
831
- # Example: https://downloads.puppetlabs.com/mac/10.11/PC1/x86_64
829
+ # Example: https://downloads.puppetlabs.com/mac/puppet7/10.15/x86_64/
832
830
  #
833
831
  # @return [String] version puppet-agent version number (e.g. 1.4.1)
834
832
  # Empty string if none found.
@@ -836,8 +834,20 @@ module Beaker
836
834
  def get_latest_puppet_agent_build_from_url(url)
837
835
  require 'oga'
838
836
  require 'net/http'
839
- body = Net::HTTP.get(URI.parse("#{url}/index_by_lastModified_reverse.html"))
840
- 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)
841
851
  agents = document.xpath('//a[contains(@href, "puppet-agent")]')
842
852
 
843
853
  latest_match = agents.shift.attributes[0].value
@@ -1,3 +1,3 @@
1
1
  module BeakerPuppet
2
- VERSION = '1.22.0'
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.0
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-08-17 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
@@ -268,7 +268,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
268
268
  - !ruby/object:Gem::Version
269
269
  version: '0'
270
270
  requirements: []
271
- rubygems_version: 3.2.22
271
+ rubygems_version: 3.2.32
272
272
  signing_key:
273
273
  specification_version: 4
274
274
  summary: Beaker's Puppet DSL Extension Helpers!