beaker-pe 1.25.0 → 1.26.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +8 -8
- data/lib/beaker-pe/install/pe_utils.rb +27 -95
- data/lib/beaker-pe/version.rb +1 -1
- data/spec/beaker-pe/install/pe_utils_spec.rb +3 -64
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
NjRjNWVlOTY5MzVhNjQyZWJmNDE0OTU0OTQ5Mjc3NzIzOGNjNThjZA==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
MTAzNDEyYTMzNzFmYmMzOTdmZDRiNjRmYWQ3ODhjYzdhOWY1YmIwOQ==
|
7
7
|
SHA512:
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
ZDQwMDdiZWI0NjliMzA1ZDQ5ZDJmNDcxMGFlNDUzNDA3MTI4ZThkMzRkM2E4
|
10
|
+
NzQyYjE3NjlmMmY1OGY0ZWVmMTY4M2Q5NDEyN2MxM2JmY2FjN2Y3NzNiZTVh
|
11
|
+
ZGUzOTZhNWI1MjdhYTk2MTEwNmJlZWY1Njg1YmRlZTI0ZmQ2NjE=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
OTBjNmY0MWI1NGIwNzU0MDVhNzhjNmI5MmJlNGFhNDNiOTkzNTI5MWFjYTBh
|
14
|
+
OWY0ZjcxZGY2NWM2NGQxZmIyMzU0NzBlY2FlNWQxOWYxYzE1ZjQyYWU5ZWU3
|
15
|
+
ZTAwMDAxOTU4ZGQ4YmQ5ZDJlZTMyYjZkZmMyMWU4ZTJmZWNjNzU=
|
@@ -101,30 +101,6 @@ module Beaker
|
|
101
101
|
end
|
102
102
|
end
|
103
103
|
|
104
|
-
# Return agent nodes with 'lb_connect' role that are not loadbalancers
|
105
|
-
def loadbalancer_connecting_agents
|
106
|
-
lb_connect_nodes = select_hosts(roles: ['lb_connect'])
|
107
|
-
lb_connect_agents = lb_connect_nodes.reject { |h| h['roles'].include?('loadbalancer')}
|
108
|
-
end
|
109
|
-
|
110
|
-
# Returns true if loadbalncer exists and is configured with 'lb_connect' role
|
111
|
-
def lb_connect_loadbalancer_exists?
|
112
|
-
if (any_hosts_as?('loadbalancer'))
|
113
|
-
lb_node = select_hosts(roles: ['loadbalancer'])
|
114
|
-
lb_node.first['roles'].include?('lb_connect')
|
115
|
-
end
|
116
|
-
end
|
117
|
-
|
118
|
-
#Returns loadbalancer if host is an agent and loadbalancer has lb_connect role
|
119
|
-
#@param [Host] agent host with lb_connect role
|
120
|
-
def get_lb_downloadhost(host)
|
121
|
-
downloadhost = master
|
122
|
-
if( ! host['roles'].include?('loadbalancer') && lb_connect_loadbalancer_exists?)
|
123
|
-
downloadhost = loadbalancer
|
124
|
-
end
|
125
|
-
downloadhost
|
126
|
-
end
|
127
|
-
|
128
104
|
# Generate the command line string needed to from a frictionless puppet-agent
|
129
105
|
# install on this host in a PE environment.
|
130
106
|
#
|
@@ -148,14 +124,6 @@ module Beaker
|
|
148
124
|
end
|
149
125
|
end
|
150
126
|
|
151
|
-
# If this is an agent node configured to connect to the loadbalancer
|
152
|
-
# using 'lb_connect' role, then use loadbalancer in the download url
|
153
|
-
# instead of master (PE-22051)
|
154
|
-
downloadhost = master
|
155
|
-
if( host['roles'].include?('lb_connect'))
|
156
|
-
downloadhost = get_lb_downloadhost(host)
|
157
|
-
end
|
158
|
-
|
159
127
|
pe_debug = host[:pe_debug] || opts[:pe_debug] ? ' -x' : ''
|
160
128
|
use_puppet_ca_cert = host[:use_puppet_ca_cert] || opts[:use_puppet_ca_cert]
|
161
129
|
|
@@ -167,7 +135,7 @@ module Beaker
|
|
167
135
|
cert_validator = '[Net.ServicePointManager]::ServerCertificateValidationCallback = {\\$true}'
|
168
136
|
end
|
169
137
|
|
170
|
-
cmd = %Q{powershell -c "cd #{host['working_dir']};#{cert_validator};\\$webClient = New-Object System.Net.WebClient;\\$webClient.DownloadFile('https://#{
|
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(' ')}"}
|
171
139
|
else
|
172
140
|
curl_opts = %w{--tlsv1 -O}
|
173
141
|
if use_puppet_ca_cert
|
@@ -176,7 +144,7 @@ module Beaker
|
|
176
144
|
curl_opts << '-k'
|
177
145
|
end
|
178
146
|
|
179
|
-
cmd = "FRICTIONLESS_TRACE='true'; export FRICTIONLESS_TRACE; cd #{host['working_dir']} && curl #{curl_opts.join(' ')} https://#{
|
147
|
+
cmd = "FRICTIONLESS_TRACE='true'; export FRICTIONLESS_TRACE; cd #{host['working_dir']} && curl #{curl_opts.join(' ')} https://#{master}:8140/packages/current/install.bash && bash#{pe_debug} install.bash #{frictionless_install_opts.join(' ')}".strip
|
180
148
|
end
|
181
149
|
|
182
150
|
return cmd
|
@@ -408,41 +376,33 @@ module Beaker
|
|
408
376
|
else
|
409
377
|
_console_dispatcher = get_console_dispatcher_for_beaker_pe!
|
410
378
|
|
411
|
-
#
|
412
|
-
#
|
413
|
-
#
|
414
|
-
|
415
|
-
|
416
|
-
|
417
|
-
|
418
|
-
|
379
|
+
# Check if we've already created a frictionless agent node group
|
380
|
+
# to avoid errors creating the same node group when the beaker hosts file contains
|
381
|
+
# multiple hosts with the same platform
|
382
|
+
node_group = _console_dispatcher.get_node_group_by_name('Beaker Frictionless Agent')
|
383
|
+
if node_group.nil? || node_group.empty?
|
384
|
+
node_group = {}
|
385
|
+
node_group['name'] = "Beaker Frictionless Agent"
|
386
|
+
# Pin the master to the node
|
387
|
+
node_group['rule'] = [ "and", [ '=', 'name', master.to_s ]]
|
388
|
+
node_group['classes'] ||= {}
|
389
|
+
end
|
419
390
|
|
420
391
|
# add the pe_repo platform class if it's not already present
|
421
|
-
if (
|
422
|
-
|
423
|
-
|
424
|
-
|
425
|
-
|
426
|
-
|
427
|
-
|
428
|
-
|
429
|
-
|
430
|
-
|
431
|
-
|
432
|
-
|
433
|
-
|
434
|
-
|
435
|
-
retry_on(master, puppet("agent -t"), retry_opts)
|
436
|
-
|
437
|
-
# Download the agent tarballs to compile masters
|
438
|
-
hosts.each do |h|
|
439
|
-
if h['roles'].include?('compile_master')
|
440
|
-
retry_on(h, puppet("agent -t"), retry_opts)
|
441
|
-
end
|
442
|
-
end
|
443
|
-
end
|
444
|
-
else
|
445
|
-
raise "Failed to add pe_repo packages, PE Master node group is not available"
|
392
|
+
if ! node_group['classes'].include?(klass)
|
393
|
+
node_group['classes'][klass] = {}
|
394
|
+
|
395
|
+
_console_dispatcher.create_new_node_group_model(node_group)
|
396
|
+
# The puppet agent run that will download the agent tarballs to the master can sometimes fail with
|
397
|
+
# curl errors if there is a network hiccup. Use beakers `retry_on` method to retry up to
|
398
|
+
# three times to avoid failing the entire test pipeline due to a network blip
|
399
|
+
retry_opts = {
|
400
|
+
:desired_exit_codes => [0,2],
|
401
|
+
:max_retries => 3,
|
402
|
+
# Beakers retry_on method wants the verbose value to be a string, not a bool.
|
403
|
+
:verbose => 'true'
|
404
|
+
}
|
405
|
+
retry_on(master, puppet("agent -t"), retry_opts)
|
446
406
|
end
|
447
407
|
end
|
448
408
|
end
|
@@ -1589,34 +1549,6 @@ module Beaker
|
|
1589
1549
|
end
|
1590
1550
|
end
|
1591
1551
|
end
|
1592
|
-
|
1593
|
-
# Method to install just the agent nodes
|
1594
|
-
# This method can be called only after installing PE on all other nodes
|
1595
|
-
# including infrastructure nodes, loadbalancer, hubs and spokes
|
1596
|
-
# PE-22051
|
1597
|
-
# @param [Array] agent only nodes from Beaker hosts
|
1598
|
-
# @param [Hash] opts The Beaker options hash
|
1599
|
-
#
|
1600
|
-
def install_agents_only_on(agentnodes, opts)
|
1601
|
-
if( ! agentnodes.empty?)
|
1602
|
-
configure_type_defaults_on(agentnodes)
|
1603
|
-
agentnodes.each do |host|
|
1604
|
-
if host['platform'] != master['platform']
|
1605
|
-
deploy_frictionless_to_master(host)
|
1606
|
-
end
|
1607
|
-
install_ca_cert_on(host, opts)
|
1608
|
-
on(host, installer_cmd(host, opts))
|
1609
|
-
end
|
1610
|
-
sign_certificate_for(agentnodes)
|
1611
|
-
stop_agent_on(agentnodes, :run_in_parallel => true)
|
1612
|
-
on agentnodes, puppet_agent('-t'), :acceptable_exit_codes => [0,2], :run_in_parallel => true
|
1613
|
-
agentnodes.select {|agent| agent['platform'] =~ /windows/}.each do |agent|
|
1614
|
-
client_datadir = agent.puppet['client_datadir']
|
1615
|
-
on(agent, puppet("resource file \"#{client_datadir}\" ensure=absent force=true"))
|
1616
|
-
end
|
1617
|
-
end
|
1618
|
-
end
|
1619
|
-
|
1620
1552
|
end
|
1621
1553
|
end
|
1622
1554
|
end
|
data/lib/beaker-pe/version.rb
CHANGED
@@ -60,17 +60,6 @@ describe ClassMixedWithDSLInstallUtils do
|
|
60
60
|
:working_dir => '/tmp',
|
61
61
|
:dist => 'puppet-enterprise-3.7.1-rc0-78-gffc958f-eos-4-i386' } ) }
|
62
62
|
|
63
|
-
let(:lei_hosts) { make_hosts( { :pe_ver => '3.0',
|
64
|
-
:platform => 'linux',
|
65
|
-
:roles => [ 'agent' ],
|
66
|
-
:type => 'pe'}, 4 ) }
|
67
|
-
let(:lb_test_hosts) { lei_hosts[0][:roles] = ['master', 'database', 'dashboard']
|
68
|
-
lei_hosts[1][:roles] = ['loadbalancer', 'lb_connect']
|
69
|
-
lei_hosts[2][:roles] = ['compile_master']
|
70
|
-
lei_hosts[3][:roles] = ['frictionless', 'lb_connect']
|
71
|
-
lei_hosts[3][:working_dir] = '/tmp'
|
72
|
-
lei_hosts }
|
73
|
-
|
74
63
|
context '#prep_host_for_upgrade' do
|
75
64
|
|
76
65
|
it 'sets per host options before global options' do
|
@@ -199,22 +188,6 @@ describe ClassMixedWithDSLInstallUtils do
|
|
199
188
|
end
|
200
189
|
end
|
201
190
|
|
202
|
-
describe 'loadbalancer_connecting_agents' do
|
203
|
-
it 'no hosts are chosen if there are no agents with lb_connect role' do
|
204
|
-
allow( subject ).to receive(:hosts).and_return([])
|
205
|
-
end
|
206
|
-
it 'chooses agents with lb_connect role' do
|
207
|
-
allow( subject ).to receive(:lb_test_hosts).and_return([lb_test_hosts[3]])
|
208
|
-
end
|
209
|
-
|
210
|
-
end
|
211
|
-
|
212
|
-
describe 'get_lb_downloadhost' do
|
213
|
-
it 'choose lb_connect loadbalancer, if there is one' do
|
214
|
-
allow( subject ).to receive(:lb_test_hosts[3]).and_return([lb_test_hosts[1]])
|
215
|
-
end
|
216
|
-
end
|
217
|
-
|
218
191
|
describe 'frictionless_agent_installer_cmd' do
|
219
192
|
let(:host) do
|
220
193
|
the_host = unixhost.dup
|
@@ -292,18 +265,6 @@ describe ClassMixedWithDSLInstallUtils do
|
|
292
265
|
"\""
|
293
266
|
expect( subject.frictionless_agent_installer_cmd( host, {}, '2016.4.0' ) ).to eq(expecting)
|
294
267
|
end
|
295
|
-
|
296
|
-
it 'generates a frictionless install command with loadbalancer as download host' do
|
297
|
-
hosts = lb_test_hosts
|
298
|
-
expect( subject ).to receive( :get_lb_downloadhost ).with(lb_test_hosts[3]).and_return( 'testloadbalancer' )
|
299
|
-
expecting = [
|
300
|
-
"FRICTIONLESS_TRACE='true'",
|
301
|
-
"export FRICTIONLESS_TRACE",
|
302
|
-
"cd /tmp && curl --tlsv1 -O -k https://testloadbalancer:8140/packages/current/install.bash && bash install.bash"
|
303
|
-
].join("; ")
|
304
|
-
|
305
|
-
expect( subject.frictionless_agent_installer_cmd( lb_test_hosts[3], {}, '2016.4.0' ) ).to eq(expecting)
|
306
|
-
end
|
307
268
|
end
|
308
269
|
|
309
270
|
describe 'install_ca_cert_on' do
|
@@ -1118,14 +1079,8 @@ describe ClassMixedWithDSLInstallUtils do
|
|
1118
1079
|
describe '#deploy_frictionless_to_master' do
|
1119
1080
|
let(:master) { make_host('master', :pe_ver => '2017.2', :platform => 'ubuntu-16.04-x86_64', :roles => ['master', 'database', 'dashboard']) }
|
1120
1081
|
let(:agent) { make_host('agent', :pe_ver => '2017.2', :platform => 'el-7-x86_64', :roles => ['frictionless']) }
|
1121
|
-
let(:compile_master) { make_host('agent', :pe_ver => '2017.2', :roles => ['frictionless', 'compile_master']) }
|
1122
1082
|
let(:dispatcher) { double('dispatcher') }
|
1123
|
-
let(:node_group)
|
1124
|
-
{
|
1125
|
-
'classes' => {
|
1126
|
-
},
|
1127
|
-
}
|
1128
|
-
end
|
1083
|
+
let(:node_group) { {} }
|
1129
1084
|
|
1130
1085
|
before :each do
|
1131
1086
|
allow(subject).to receive(:retry_on)
|
@@ -1135,12 +1090,12 @@ describe ClassMixedWithDSLInstallUtils do
|
|
1135
1090
|
|
1136
1091
|
allow(dispatcher).to receive(:get_node_group_by_name).and_return(node_group)
|
1137
1092
|
allow(dispatcher).to receive(:create_new_node_group_model) {|model| node_group.update(model)}
|
1138
|
-
allow(subject).to receive(:compile_masters).and_return([compile_master])
|
1139
1093
|
end
|
1140
1094
|
|
1141
|
-
it 'adds the right pe_repo class to the
|
1095
|
+
it 'adds the right pe_repo class to the Beaker Frictionless Agent group' do
|
1142
1096
|
subject.deploy_frictionless_to_master(agent)
|
1143
1097
|
|
1098
|
+
expect(node_group['rule']).to eq(['and', ['=', 'name', 'master']])
|
1144
1099
|
expect(node_group['classes']).to include('pe_repo::platform::el_7_x86_64')
|
1145
1100
|
end
|
1146
1101
|
|
@@ -1503,22 +1458,6 @@ describe ClassMixedWithDSLInstallUtils do
|
|
1503
1458
|
allow(subject).to receive(:sign_certificate_for)
|
1504
1459
|
end
|
1505
1460
|
|
1506
|
-
describe 'install_agents_only_on' do
|
1507
|
-
let(:lb_agent) { make_host('agent', :pe_ver => '2016.4', :platform => 'debian-7-x86_64', :roles => ['frictionless', 'lb_connect']) }
|
1508
|
-
|
1509
|
-
before :each do
|
1510
|
-
allow(subject).to receive(:on)
|
1511
|
-
allow(subject).to receive(:configure_type_defaults_on)
|
1512
|
-
allow(subject).to receive(:deploy_frictionless_to_master)
|
1513
|
-
allow(subject).to receive(:install_agents_only_on)
|
1514
|
-
|
1515
|
-
allow(subject).to receive(:installer_cmd).with(lb_agent, anything()).and_return("install lb agent")
|
1516
|
-
|
1517
|
-
allow(subject).to receive(:stop_agent_on)
|
1518
|
-
allow(subject).to receive(:sign_certificate_for)
|
1519
|
-
end
|
1520
|
-
end
|
1521
|
-
|
1522
1461
|
describe 'configuring frictionless installer' do
|
1523
1462
|
it "skips the master's platform" do
|
1524
1463
|
expect(subject).not_to receive(:deploy_frictionless_to_master)
|
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.
|
4
|
+
version: 1.26.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-11-
|
11
|
+
date: 2017-11-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rspec
|