beaker-pe 1.22.0 → 1.23.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- NGY2NDk1YjBkNjNhNTgxNzMxMmUzNzdmODQwZWVmMzJlZWJkYWQ5Ng==
4
+ MjlmYWQxODA1M2Q3NzI3ZTM0YWNkNzk0Y2E4MDI1YWJmMzVmNTc4ZA==
5
5
  data.tar.gz: !binary |-
6
- MmY3YWU0M2E5YzUyMGU0ZjU1MDc5ZWIwODRhYzc5ZWI4ODZmZTIwNA==
6
+ YWFiNmVkMTJiNDM1YTk1ODQ2MTk1ZDRlZWI3ZDJmYzM4MzQ3YjcxYg==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- NmRmN2FkYjg2MTk0NTVhMWY4Yjk4YTYwN2UyYTI4NzEwYmRmYzVhNDg5MmIy
10
- MTE3NjlmOGI3ODBkZTg1YTdmMjFmNmJiMjg5NDgxOTBkOWNlZmMzODAwMzZl
11
- NmQwNmIzYWZjODMyMjg1Y2M0ZTUxM2FmYjczYWNiMGM0YTc0ZTg=
9
+ MTg4NTllZTMzNjBiMTZiZTM4YmUyYzQxNDllNDM4OTU4Yjg3ZDc0NzI0ODA0
10
+ MTRjOTA3N2Y1ZDg2YWM1ZmU1NGRiYjY1ZDFmYjY2ZGVjZjZlYjMyMTRkNGEy
11
+ MmZjNzkwNzcyYjIzYmI4ZjUxNjhmNGI1NmRjMjAxNmNkZGI2MTU=
12
12
  data.tar.gz: !binary |-
13
- NmI2ODYyOTE0ZDkyNTQ3Y2MxODYxOGQ4ZmVjMTRjODgwOWM0M2U1MTI1OTJh
14
- NDFkYmNlMjliNGJmNTVmNGUzZTVhZDgyNTVlMTQwNTA1ZDgyZTNmYjVmN2Mx
15
- YTg5OThhMGZjMWNhMDQyNDJlNTliYjhjOGMyM2FiYzRmNDM3NGU=
13
+ YTJkOWVkYzc4ZjhhYWRkZmRlZWFkOTM2OTY1NmVjMjA1ZWRmYmUzODkzOWU2
14
+ MThkYzYxOTJkMmM2MTc0NDk1NzE0ODhhMmNiNDkyNjVmN2EzZjZjNTJkMjFh
15
+ ZmE0NzJiYmIwNWM4OTJkYzEwZGM0MmE1ZTE4ZTllOTc2N2Y0MTE=
data/README.md CHANGED
@@ -37,6 +37,11 @@ things:
37
37
  2. put a `require 'beaker-pe'` statement in your tests/code that need
38
38
  beaker-pe-specific functionality
39
39
 
40
+ # Gem Installing
41
+ Spec tests require a version of scooter that is private. Execute
42
+ `export GEM_SOURCE=http://rubygems.delivery.puppetlabs.net` prior to running
43
+ `bundle install --path .bundle/gems/`.
44
+
40
45
  # Spec Testing
41
46
 
42
47
  Spec tests all live under the `spec` folder. These are the default rake task, &
@@ -92,11 +92,11 @@ module Beaker
92
92
  @cert_cache_dir ||= Dir.mktmpdir("master_ca_cert")
93
93
  local_cert_copy = "#{@cert_cache_dir}/ca.pem"
94
94
  step "Copying master ca.pem to agent for secure frictionless install" do
95
- ca_pem_dir = '/etc/puppetlabs/puppet/ssl/certs'
96
- ca_pem_path = "#{ca_pem_dir}/ca.pem"
97
- scp_from(master, ca_pem_path , @cert_cache_dir) unless File.exist?(local_cert_copy)
98
- on(host, "mkdir -p #{ca_pem_dir}")
99
- scp_to(host, local_cert_copy, ca_pem_dir)
95
+ agent_ca_pem_dir = "#{host['puppetpath']}/ssl/certs"
96
+ master_ca_pem_path = "/etc/puppetlabs/puppet/ssl/certs/ca.pem"
97
+ scp_from(master, master_ca_pem_path , @cert_cache_dir) unless File.exist?(local_cert_copy)
98
+ on(host, "mkdir -p #{agent_ca_pem_dir}")
99
+ scp_to(host, local_cert_copy, agent_ca_pem_dir)
100
100
  end
101
101
  end
102
102
  end
@@ -128,7 +128,14 @@ module Beaker
128
128
  use_puppet_ca_cert = host[:use_puppet_ca_cert] || opts[:use_puppet_ca_cert]
129
129
 
130
130
  if host['platform'] =~ /windows/ then
131
- cmd = %Q{powershell -c "cd #{host['working_dir']};[Net.ServicePointManager]::ServerCertificateValidationCallback = {\\$true};\\$webClient = New-Object System.Net.WebClient;\\$webClient.DownloadFile('https://#{master}:8140/packages/current/install.ps1', '#{host['working_dir']}/install.ps1');#{host['working_dir']}/install.ps1 -verbose #{frictionless_install_opts.join(' ')}"}
131
+ if use_puppet_ca_cert
132
+ frictionless_install_opts << '-UsePuppetCA'
133
+ cert_validator = %Q{\\$callback = {param(\\$sender,[System.Security.Cryptography.X509Certificates.X509Certificate]\\$certificate,[System.Security.Cryptography.X509Certificates.X509Chain]\\$chain,[System.Net.Security.SslPolicyErrors]\\$sslPolicyErrors);\\$CertificateType=[System.Security.Cryptography.X509Certificates.X509Certificate2];\\$CACert=\\$CertificateType::CreateFromCertFile('#{host['puppetpath']}/ssl/certs/ca.pem') -as \\$CertificateType;\\$chain.ChainPolicy.ExtraStore.Add(\\$CACert);return \\$chain.Build(\\$certificate)};[Net.ServicePointManager]::ServerCertificateValidationCallback = \\$callback}
134
+ else
135
+ cert_validator = '[Net.ServicePointManager]::ServerCertificateValidationCallback = {\\$true}'
136
+ end
137
+
138
+ cmd = %Q{powershell -c "cd #{host['working_dir']};#{cert_validator};\\$webClient = New-Object System.Net.WebClient;\\$webClient.DownloadFile('https://#{master}:8140/packages/current/install.ps1', '#{host['working_dir']}/install.ps1');#{host['working_dir']}/install.ps1 -verbose #{frictionless_install_opts.join(' ')}"}
132
139
  else
133
140
  curl_opts = %w{--tlsv1 -O}
134
141
  if use_puppet_ca_cert
@@ -61,6 +61,15 @@ module Beaker
61
61
  Private.new.tool(:query, *args, &block)
62
62
  end
63
63
 
64
+ # puppet-task helper win/lin/osx
65
+ # @param [BEAKER::Host] host The SUT that should run the puppet-task command
66
+ # @param [String] args The arguments to puppet-task
67
+ # @param [Hash] opts options hash to the Beaker Command
68
+ # @param [Block] &block optional block
69
+ def puppet_task_on(*args, &block)
70
+ Private.new.tool(:task, *args, &block)
71
+ end
72
+
64
73
  # Logs a user in on a SUT with puppet-access/RBAC API (windows)
65
74
  # @param [Beaker::Host] host The SUT to perform the login on
66
75
  # @param [Scooter::HttpDispatchers::ConsoleDispatcher] credentialed_dispatcher A Scooter dispatcher that has credentials for the user
@@ -3,7 +3,7 @@ module Beaker
3
3
  module PE
4
4
 
5
5
  module Version
6
- STRING = '1.22.0'
6
+ STRING = '1.23.0'
7
7
  end
8
8
 
9
9
  end
@@ -200,22 +200,70 @@ describe ClassMixedWithDSLInstallUtils do
200
200
  end
201
201
 
202
202
  it 'generates a unix PE frictionless install command without cert verification' do
203
- expect( subject.frictionless_agent_installer_cmd( host, {}, '2016.4.0' ) ).to eq("FRICTIONLESS_TRACE='true'; export FRICTIONLESS_TRACE; cd /tmp && curl --tlsv1 -O -k https://testmaster:8140/packages/current/install.bash && bash install.bash")
203
+ expecting = [
204
+ "FRICTIONLESS_TRACE='true'",
205
+ "export FRICTIONLESS_TRACE",
206
+ "cd /tmp && curl --tlsv1 -O -k https://testmaster:8140/packages/current/install.bash && bash install.bash"
207
+ ].join("; ")
208
+
209
+ expect( subject.frictionless_agent_installer_cmd( host, {}, '2016.4.0' ) ).to eq(expecting)
204
210
  end
205
211
 
206
212
  it 'generates a unix PE frictionless install command with cert verification' do
207
213
  host['use_puppet_ca_cert'] = true
208
- expect( subject.frictionless_agent_installer_cmd( host, {}, '2016.4.0' ) ).to eq("FRICTIONLESS_TRACE='true'; export FRICTIONLESS_TRACE; cd /tmp && curl --tlsv1 -O --cacert /etc/puppetlabs/puppet/ssl/certs/ca.pem https://testmaster:8140/packages/current/install.bash && bash install.bash")
214
+ expecting = [
215
+ "FRICTIONLESS_TRACE='true'",
216
+ "export FRICTIONLESS_TRACE",
217
+ "cd /tmp && curl --tlsv1 -O --cacert /etc/puppetlabs/puppet/ssl/certs/ca.pem https://testmaster:8140/packages/current/install.bash && bash install.bash"
218
+ ].join("; ")
219
+
220
+ expect( subject.frictionless_agent_installer_cmd( host, {}, '2016.4.0' ) ).to eq(expecting)
209
221
  end
210
222
 
211
223
  it 'generates a unix PE frictionless install command without cert verification on aix' do
212
224
  host['platform'] = 'aix-61-power'
213
- expect( subject.frictionless_agent_installer_cmd( host, {}, '2016.4.0' ) ).to eq("FRICTIONLESS_TRACE='true'; export FRICTIONLESS_TRACE; cd /tmp && curl --tlsv1 -O https://testmaster:8140/packages/current/install.bash && bash install.bash")
225
+ expecting = [
226
+ "FRICTIONLESS_TRACE='true'",
227
+ "export FRICTIONLESS_TRACE",
228
+ "cd /tmp && curl --tlsv1 -O https://testmaster:8140/packages/current/install.bash && bash install.bash"
229
+ ].join("; ")
230
+
231
+ expect( subject.frictionless_agent_installer_cmd( host, {}, '2016.4.0' ) ).to eq(expecting)
232
+ end
233
+
234
+ it 'generates a PS1 frictionless install command for windows' do
235
+ host['platform'] = 'windows-2012-64'
236
+ expecting = "powershell -c \"" +
237
+ [
238
+ "cd /tmp",
239
+ "[Net.ServicePointManager]::ServerCertificateValidationCallback = {\\$true}",
240
+ "\\$webClient = New-Object System.Net.WebClient",
241
+ "\\$webClient.DownloadFile('https://testmaster:8140/packages/current/install.ps1', '/tmp/install.ps1')",
242
+ "/tmp/install.ps1 -verbose "
243
+ ].join(";") +
244
+ "\""
245
+ expect( subject.frictionless_agent_installer_cmd( host, {}, '2016.4.0' ) ).to eq(expecting)
214
246
  end
215
247
 
216
248
  it 'generates a PS1 frictionless install command for windows' do
217
249
  host['platform'] = 'windows-2012-64'
218
- expect( subject.frictionless_agent_installer_cmd( host, {}, '2016.4.0' ) ).to eq(%q{powershell -c "cd /tmp;[Net.ServicePointManager]::ServerCertificateValidationCallback = {\\$true};\\$webClient = New-Object System.Net.WebClient;\\$webClient.DownloadFile('https://testmaster:8140/packages/current/install.ps1', '/tmp/install.ps1');/tmp/install.ps1 -verbose "})
250
+ host['puppetpath'] = '/PuppetLabs/puppet/etc'
251
+ host['use_puppet_ca_cert'] = true
252
+ expecting = "powershell -c \"" +
253
+ [
254
+ "cd /tmp",
255
+ "\\$callback = {param(\\$sender,[System.Security.Cryptography.X509Certificates.X509Certificate]\\$certificate,[System.Security.Cryptography.X509Certificates.X509Chain]\\$chain,[System.Net.Security.SslPolicyErrors]\\$sslPolicyErrors)",
256
+ "\\$CertificateType=[System.Security.Cryptography.X509Certificates.X509Certificate2]",
257
+ "\\$CACert=\\$CertificateType::CreateFromCertFile('/PuppetLabs/puppet/etc/ssl/certs/ca.pem') -as \\$CertificateType",
258
+ "\\$chain.ChainPolicy.ExtraStore.Add(\\$CACert)",
259
+ "return \\$chain.Build(\\$certificate)}",
260
+ "[Net.ServicePointManager]::ServerCertificateValidationCallback = \\$callback",
261
+ "\\$webClient = New-Object System.Net.WebClient",
262
+ "\\$webClient.DownloadFile('https://testmaster:8140/packages/current/install.ps1', '#{host['working_dir']}/install.ps1')",
263
+ "/tmp/install.ps1 -verbose -UsePuppetCA"
264
+ ].join(";") +
265
+ "\""
266
+ expect( subject.frictionless_agent_installer_cmd( host, {}, '2016.4.0' ) ).to eq(expecting)
219
267
  end
220
268
  end
221
269
 
@@ -232,6 +280,7 @@ describe ClassMixedWithDSLInstallUtils do
232
280
 
233
281
  it 'installs ca.pem if use_puppet_ca_cert is true' do
234
282
  host['use_puppet_ca_cert'] = true
283
+ host['puppetpath'] = '/etc/puppetlabs/puppet'
235
284
  expect(Dir).to receive(:mktmpdir).with('master_ca_cert').and_return('/tmp/master_ca_cert_random')
236
285
  expect(subject).to receive(:on).with(host, 'mkdir -p /etc/puppetlabs/puppet/ssl/certs')
237
286
  expect(subject).to receive(:scp_from).with('testmaster', '/etc/puppetlabs/puppet/ssl/certs/ca.pem', %r{/tmp/master_ca_cert_random})
@@ -52,6 +52,12 @@ describe MixedWithExecutableHelper do
52
52
  it_behaves_like 'pe-client-tool'
53
53
  end
54
54
 
55
+ context 'puppet-task' do
56
+ let(:tool) {'task'}
57
+
58
+ it_behaves_like 'pe-client-tool'
59
+ end
60
+
55
61
  it 'has a method to login with puppet access' do
56
62
  expect(subject.respond_to?('login_with_puppet_access_on')).not_to be(false)
57
63
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: beaker-pe
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
  - Puppetlabs
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-08-01 00:00:00.000000000 Z
11
+ date: 2017-09-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rspec