beaker-puppet 1.18.14 → 1.20.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: 3b61d545a1c2daedf8db34d1022483acc0ccd04632bb0bee75dc31b944e7fd3e
4
- data.tar.gz: 188fe64c83a71c7b7993990c66f6da3c9533925a69ba5c94254808f02709b8e5
3
+ metadata.gz: 737b37a67f54e2d13971fdf418e83dbd137a25a3c438d2686b0b8b6d53c30d32
4
+ data.tar.gz: ef74b57af652ae95c6dd51f5d4edb418cf18d4120ffe9d07156ca70de3bfd0d2
5
5
  SHA512:
6
- metadata.gz: ec8bcf9a562252bf3ea35d721399e3b96d4811bfba3a060100af5300bef787af7ca0fce736c0aa8e4a3d9d67901ee7b4ace4957cfa9d321a8227fa9d84a39f83
7
- data.tar.gz: 62fe04f6113bd92d51215a40cca5bc4433411ab421366c70e532e380983064d1d4b2666771e099893cb3e4dcc206acf64ad557fdd3e8f8f02c09c4e3ac10303c
6
+ metadata.gz: 8cf482925c059096d7065862cac1dc6915b4e12371cd03f6be7e896e287933358a412e038b879bf19cca9705a16e85d4c789a75de098f4bce7d8fb78a003ff04
7
+ data.tar.gz: af50c97c0c401b087362530da9b03b1d5dc686d5c3430beea1965cbbcbf864cfc1264abca9149562803d45959ecc6753127862e0cb0dcbc6e7e658e31eb4e205
@@ -0,0 +1,8 @@
1
+ version: 2
2
+ updates:
3
+ - package-ecosystem: bundler
4
+ directory: "/"
5
+ schedule:
6
+ interval: daily
7
+ time: "13:00"
8
+ open-pull-requests-limit: 10
@@ -0,0 +1,10 @@
1
+ before_install:
2
+ - gem update
3
+ - gem --version
4
+ language: ruby
5
+ script: "bundle exec rake test:spec"
6
+ notifications:
7
+ email: false
8
+ rvm:
9
+ - 2.6
10
+ - 2.4
data/CODEOWNERS CHANGED
@@ -1,3 +0,0 @@
1
- #This Repository is maintained by both the beaker and Night's Watch teams, depending on the location of the changes
2
- * @puppetlabs/beaker
3
- * @puppetlabs/night-s-watch
@@ -4,8 +4,8 @@ require 'beaker-puppet'
4
4
  # all versions are required for osx
5
5
  hosts.each do |host|
6
6
  install_puppet_on(host, {
7
- :version => ENV['BEAKER_PUPPET_VERSION'] || '5.5.13',
8
- :puppet_agent_version => ENV['BEAKER_PUPPET_AGENT_VERSION'] || '5.5.13'
7
+ :version => ENV['BEAKER_PUPPET_VERSION'] || '5.5.20',
8
+ :puppet_agent_version => ENV['BEAKER_PUPPET_AGENT_VERSION'] || '5.5.20'
9
9
  })
10
10
 
11
11
  on(host, puppet('resource user puppet ensure=present'))
@@ -21,7 +21,7 @@ Gem::Specification.new do |s|
21
21
  s.add_development_dependency 'rspec', '~> 3.0'
22
22
  s.add_development_dependency 'rspec-its'
23
23
  s.add_development_dependency 'fakefs', '~> 0.6', '< 0.14.0'
24
- s.add_development_dependency 'rake', '~> 10.1'
24
+ s.add_development_dependency 'rake', '~> 13.0'
25
25
  s.add_development_dependency 'simplecov'
26
26
  s.add_development_dependency 'pry', '~> 0.10'
27
27
 
@@ -7,7 +7,11 @@ module Beaker
7
7
  module HostHelpers
8
8
 
9
9
  def ruby_command(host)
10
- "env PATH=\"#{host['privatebindir']}:${PATH}\" ruby"
10
+ if host['platform'] =~ /windows/ && !host.is_cygwin?
11
+ "cmd /V /C \"set PATH=#{host['privatebindir']};!PATH! && ruby\""
12
+ else
13
+ "env PATH=\"#{host['privatebindir']}:${PATH}\" ruby"
14
+ end
11
15
  end
12
16
 
13
17
  # Returns an array containing the owner, group and mode of
@@ -677,7 +677,8 @@ module Beaker
677
677
 
678
678
  if host.is_cygwin?
679
679
  # NOTE: it is critical that -o be before -O on Windows
680
- on host, "curl -o \"#{msi_download_path}\" -O #{link}"
680
+ proxy = opts[:package_proxy] ? "-x #{opts[:package_proxy]} " : ''
681
+ on host, "curl #{proxy}-o \"#{msi_download_path}\" -O #{link}"
681
682
 
682
683
  #Because the msi installer doesn't add Puppet to the environment path
683
684
  #Add both potential paths for simplicity
@@ -685,7 +686,8 @@ module Beaker
685
686
  puppetbin_path = "\"/cygdrive/c/Program Files (x86)/Puppet Labs/Puppet/bin\":\"/cygdrive/c/Program Files/Puppet Labs/Puppet/bin\""
686
687
  on host, %Q{ echo 'export PATH=$PATH:#{puppetbin_path}' > /etc/bash.bashrc }
687
688
  else
688
- on host, powershell("$webclient = New-Object System.Net.WebClient; $webclient.DownloadFile('#{link}','#{msi_download_path}')")
689
+ webclient_proxy = opts[:package_proxy] ? "$webclient.Proxy = New-Object System.Net.WebProxy('#{opts[:package_proxy]}',$true); " : ''
690
+ on host, powershell("$webclient = New-Object System.Net.WebClient; #{webclient_proxy}$webclient.DownloadFile('#{link}','#{msi_download_path}')")
689
691
  end
690
692
 
691
693
  opts = { :debug => host[:pe_debug] || opts[:pe_debug] }
@@ -115,19 +115,21 @@ module Beaker
115
115
  block_on hosts do | host |
116
116
  msi_opts['PUPPET_AGENT_STARTUP_MODE'] ||= 'Manual'
117
117
  batch_path, log_file = create_install_msi_batch_on(host, msi_path, msi_opts)
118
-
118
+ # Powershell command looses an escaped slash resulting in cygwin relative path
119
+ # See https://github.com/puppetlabs/beaker/pull/1626#issuecomment-621341555
120
+ log_file_escaped = log_file.gsub('\\','\\\\\\')
119
121
  # begin / rescue here so that we can reuse existing error msg propagation
120
122
  begin
121
123
  # 1641 = ERROR_SUCCESS_REBOOT_INITIATED
122
124
  # 3010 = ERROR_SUCCESS_REBOOT_REQUIRED
123
125
  on host, Command.new("\"#{batch_path}\"", [], { :cmdexe => true }), :acceptable_exit_codes => [0, 1641, 3010]
124
126
  rescue
125
- logger.info(file_contents_on(host, log_file))
127
+ logger.info(file_contents_on(host, log_file_escaped))
126
128
  raise
127
129
  end
128
130
 
129
131
  if opts[:debug]
130
- logger.info(file_contents_on(host, log_file))
132
+ logger.info(file_contents_on(host, log_file_escaped))
131
133
  end
132
134
 
133
135
  unless host.is_cygwin?
@@ -175,8 +177,8 @@ module Beaker
175
177
  # emit the misc/versions.txt file which contains component versions for
176
178
  # puppet, facter, hiera, pxp-agent, packaging and vendored Ruby
177
179
  [
178
- '%ProgramFiles%/Puppet Labs/puppet/misc/versions.txt',
179
- '%ProgramFiles(x86)%/Puppet Labs/puppet/misc/versions.txt'
180
+ '"${env:ProgramFiles}/Puppet Labs/puppet/misc/versions.txt"',
181
+ '"${env:ProgramFiles(x86)}/Puppet Labs/puppet/misc/versions.txt"'
180
182
  ].each do |path|
181
183
  if file_exists_on(host, path)
182
184
  logger.info(file_contents_on(host, path)) && break
@@ -201,20 +203,22 @@ module Beaker
201
203
  def generic_install_msi_on(hosts, msi_path, msi_opts = {}, opts = {})
202
204
  block_on hosts do | host |
203
205
  batch_path, log_file = create_install_msi_batch_on(host, msi_path, msi_opts)
204
-
206
+ # Powershell command looses an escaped slash resulting in cygwin relative path
207
+ # See https://github.com/puppetlabs/beaker/pull/1626#issuecomment-621341555
208
+ log_file_escaped = log_file.gsub('\\','\\\\\\')
205
209
  # begin / rescue here so that we can reuse existing error msg propagation
206
210
  begin
207
211
  # 1641 = ERROR_SUCCESS_REBOOT_INITIATED
208
212
  # 3010 = ERROR_SUCCESS_REBOOT_REQUIRED
209
213
  on host, Command.new("\"#{batch_path}\"", [], { :cmdexe => true }), :acceptable_exit_codes => [0, 1641, 3010]
210
214
  rescue
211
- logger.info(file_contents_on(host, log_file))
215
+ logger.info(file_contents_on(host, log_file_escaped))
212
216
 
213
217
  raise
214
218
  end
215
219
 
216
220
  if opts[:debug]
217
- logger.info(file_contents_on(host, log_file))
221
+ logger.info(file_contents_on(host, log_file_escaped))
218
222
  end
219
223
 
220
224
  host.close unless host.is_cygwin?
@@ -1,3 +1,3 @@
1
1
  module BeakerPuppet
2
- VERSION = '1.18.14'
2
+ VERSION = '1.20.0'
3
3
  end
@@ -0,0 +1,29 @@
1
+ require 'spec_helper'
2
+
3
+ class ClassMixedWithDSLHelpers
4
+ include Beaker::DSL::Helpers::HostHelpers
5
+ end
6
+
7
+ describe ClassMixedWithDSLHelpers do
8
+ let(:privatebindir) { 'C:\\Program Files\\Puppet Labs\\Puppet\\bin' }
9
+
10
+ context 'when platform is windows and non cygwin' do
11
+ let(:winhost) { make_host('winhost_non_cygwin', { :platform => 'windows',
12
+ :privatebindir => privatebindir,
13
+ :is_cygwin => 'false' }) }
14
+
15
+ it 'run the correct ruby_command' do
16
+ expect(subject.ruby_command(winhost)).to eq("cmd /V /C \"set PATH=#{privatebindir};!PATH! && ruby\"")
17
+ end
18
+ end
19
+
20
+ context 'when platform is windows and cygwin' do
21
+ let(:winhost) { make_host('winhost', { :platform => Beaker::Platform.new('windows-2016-a64'),
22
+ :privatebindir => privatebindir,
23
+ :is_cygwin => true }) }
24
+
25
+ it 'run the correct ruby_command' do
26
+ expect(subject.ruby_command(winhost)).to eq("env PATH=\"#{privatebindir}:${PATH}\" ruby")
27
+ end
28
+ end
29
+ end
@@ -38,6 +38,7 @@ describe ClassMixedWithDSLInstallUtils do
38
38
  :working_dir => '/tmp',
39
39
  :type => 'foss',
40
40
  :is_cygwin => 'false' } ) }
41
+
41
42
  let(:machost) { make_host( 'machost', { :platform => 'osx-10.9-x86_64',
42
43
  :pe_ver => '3.0',
43
44
  :type => 'foss',
@@ -347,6 +348,15 @@ describe ClassMixedWithDSLInstallUtils do
347
348
  subject.install_puppet_from_msi( winhost, {:version => '3.7.1', :win_download_url => 'http://downloads.puppet.com/windows'} )
348
349
  end
349
350
 
351
+ it 'installs puppet on cygwin windows via proxy' do
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")
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
+ expect(subject).to receive(:install_msi_on).with(winhost, "#{win_temp}\\puppet-3.7.1-x64.msi", {}, {:debug => nil})
356
+
357
+ subject.install_puppet_from_msi( winhost, {:version => '3.7.1', :win_download_url => 'http://downloads.puppet.com/windows', :package_proxy => 'https://proxy.com'} )
358
+ end
359
+
350
360
  it 'installs puppet on non-cygwin windows' do
351
361
  allow(subject).to receive(:link_exists?).and_return( true )
352
362
 
@@ -354,13 +364,29 @@ describe ClassMixedWithDSLInstallUtils do
354
364
 
355
365
  expect(subject).to receive(:on).with(winhost_non_cygwin, instance_of( Beaker::Command )) do |host, beaker_command|
356
366
  expect(beaker_command.command).to eq('powershell.exe')
357
- expect(beaker_command.args).to eq(["-ExecutionPolicy Bypass", "-InputFormat None", "-NoLogo", "-NoProfile", "-NonInteractive", "-Command $webclient = New-Object System.Net.WebClient; $webclient.DownloadFile('http://downloads.puppet.com/windows/puppet-3.7.1.msi','#{win_temp}\\puppet-3.7.1.msi')"])
367
+ expect(beaker_command.args).to eq(["-ExecutionPolicy Bypass", "-InputFormat None", "-NoLogo", "-NoProfile", "-NonInteractive", "-Command $webclient = New-Object System.Net.WebClient; $webclient.DownloadFile('http://downloads.puppet.com/windows/puppet-3.7.1.msi','#{win_temp}\\puppet-3.7.1.msi')"])
358
368
  end.once
359
369
 
360
370
  expect(subject).to receive(:install_msi_on).with(winhost_non_cygwin, "#{win_temp}\\puppet-3.7.1.msi", {}, {:debug => nil})
361
371
 
362
372
  subject.install_puppet_from_msi( winhost_non_cygwin, {:version => '3.7.1', :win_download_url => 'http://downloads.puppet.com/windows'} )
363
373
  end
374
+
375
+ it 'installs puppet on non-cygwin windows via proxy' do
376
+ allow(subject).to receive(:link_exists?).and_return( true )
377
+
378
+ expect(winhost_non_cygwin).to receive(:mkdir_p).with('C:\\ProgramData\\PuppetLabs\\puppet\\etc\\modules')
379
+
380
+ expect(subject).to receive(:on).with(winhost_non_cygwin, instance_of( Beaker::Command )) do |host, beaker_command|
381
+ expect(beaker_command.command).to eq('powershell.exe')
382
+ expect(beaker_command.args).to eq(["-ExecutionPolicy Bypass", "-InputFormat None", "-NoLogo", "-NoProfile", "-NonInteractive", "-Command $webclient = New-Object System.Net.WebClient; $webclient.Proxy = New-Object System.Net.WebProxy('https://proxy.com',$true); $webclient.DownloadFile('http://downloads.puppet.com/windows/puppet-3.7.1.msi','#{win_temp}\\puppet-3.7.1.msi')"])
383
+ end.once
384
+
385
+ expect(subject).to receive(:install_msi_on).with(winhost_non_cygwin, "#{win_temp}\\puppet-3.7.1.msi", {}, {:debug => nil})
386
+
387
+ subject.install_puppet_from_msi( winhost_non_cygwin, {:version => '3.7.1', :win_download_url => 'http://downloads.puppet.com/windows', :package_proxy => 'https://proxy.com'})
388
+
389
+ end
364
390
  end
365
391
 
366
392
  context 'clone_git_repo_on' do
@@ -41,7 +41,7 @@ describe ClassMixedWithDSLInstallUtils do
41
41
  end
42
42
 
43
43
  def expect_version_log_called(times = hosts.length)
44
- path = %{%ProgramFiles%/Puppet Labs/puppet/misc/versions.txt}
44
+ path = %{"${env:ProgramFiles}/Puppet Labs/puppet/misc/versions.txt"}
45
45
 
46
46
  expect( subject ).to receive( :file_exists_on )
47
47
  .with(anything, path)
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.18.14
4
+ version: 1.20.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Puppet
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-02-20 00:00:00.000000000 Z
11
+ date: 2020-09-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rspec
@@ -64,14 +64,14 @@ dependencies:
64
64
  requirements:
65
65
  - - "~>"
66
66
  - !ruby/object:Gem::Version
67
- version: '10.1'
67
+ version: '13.0'
68
68
  type: :development
69
69
  prerelease: false
70
70
  version_requirements: !ruby/object:Gem::Requirement
71
71
  requirements:
72
72
  - - "~>"
73
73
  - !ruby/object:Gem::Version
74
- version: '10.1'
74
+ version: '13.0'
75
75
  - !ruby/object:Gem::Dependency
76
76
  name: simplecov
77
77
  requirement: !ruby/object:Gem::Requirement
@@ -206,8 +206,10 @@ executables:
206
206
  extensions: []
207
207
  extra_rdoc_files: []
208
208
  files:
209
+ - ".github/dependabot.yml"
209
210
  - ".gitignore"
210
211
  - ".simplecov"
212
+ - ".travis.yml"
211
213
  - CODEOWNERS
212
214
  - Gemfile
213
215
  - HISTORY.md
@@ -275,6 +277,7 @@ files:
275
277
  - setup/git/060_InstallModules.rb
276
278
  - setup/git/070_InstallCACerts.rb
277
279
  - spec/beaker-puppet/helpers/facter_helpers_spec.rb
280
+ - spec/beaker-puppet/helpers/host_helpers_spec.rb
278
281
  - spec/beaker-puppet/helpers/puppet_helpers_spec.rb
279
282
  - spec/beaker-puppet/helpers/tk_helpers_spec.rb
280
283
  - spec/beaker-puppet/install_utils/ezbake_utils_spec.rb
@@ -306,7 +309,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
306
309
  - !ruby/object:Gem::Version
307
310
  version: '0'
308
311
  requirements: []
309
- rubygems_version: 3.0.6
312
+ rubygems_version: 3.0.8
310
313
  signing_key:
311
314
  specification_version: 4
312
315
  summary: Beaker's Puppet DSL Extension Helpers!