beaker-pe 1.27.0 → 1.28.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
- ZGIxMzQ2NjExMDg5MGJlODU2YWYxNmFiYTZjYmE0MDcxNTVkZGRjYw==
4
+ OWVhNGRjNGI1NGZkYThmYTQ3NDliMTNkZGQ2Zjg5OTFhNjEwZmQxMA==
5
5
  data.tar.gz: !binary |-
6
- OGQzMmQ1N2FiNjNjNjMwYjIwYTdkZDIzMzgwYjkwMDNjOGU5ZmJlOQ==
6
+ Yzc5MWQ5NTFlY2U2YTc2YTNlMTIyOWVjMjVlMzQ3OTNhYjAwNWU5NQ==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- ZDc4N2Y3OTk3MTc3ZDMyMThiMTdjOGU5ZmY3MGYxYTdlMGYwM2EyNWE4NzRh
10
- NzMyNTY5NzM4OTBjODgyMjc2ZjExMTFhZDQyZDc3ZDU3ZGJkZTc3ZWM5MTBh
11
- ZWY1NTQ3M2NiNzAxYWFhMTFmZjk1NjQ1ZGVjOGNhMzAxYWFlZmQ=
9
+ YmNmNTM2MjViYzU2MTllYzNkYzg1ODFmOTc1OWVkMGRhMDc0OGUzYzg2MzU1
10
+ NDlkOTg5NGUzZGYwOTcyMjVkODI5ZDZkNzQ2YWI3ZjdlOWUwZjA2ZDQ5MTc5
11
+ ZWVhZWE5NTNjNDFlOWMwMTNlNzkwNzdhMGZjODBkNjZmZTk3Y2Y=
12
12
  data.tar.gz: !binary |-
13
- Y2MwOWVhNjFiNzBhNzEwN2U5OGZlYzgwOWY1MGE0NTUxM2YyYWRlYmNjZGY5
14
- YjE2MjM1NDdiOWU3NDgyNTk3YTZiYzZlZjlhN2RkMTIwZDdlYjVlOTU5MjA2
15
- YjdiOTRjOGI2OTBiNDMyOTljNGIzNThlZjJmY2QyYTRiYzUwZWQ=
13
+ NjdhMjg1N2U3ZDFkYjg5MDVmZGQ4ZjNiZjM4YjBmZGNmZjRhNDI5MDU3ZDgw
14
+ ZWI1ODE3ZDU1ZGEzODllYjE5ZjcyYjg5NDU5ZmI5MTY5NjJhNTQxYmQyMjU3
15
+ YjA1NTFlNmI2ZWQ5M2E4MDI0OTQ1ZWExZjRkZDMzMDM3NGI5OWU=
@@ -224,6 +224,11 @@ module Beaker
224
224
  end
225
225
  end
226
226
 
227
+ #This calls the installer command on the host in question
228
+ def execute_installer_cmd(host, opts)
229
+ on host, installer_cmd(host, opts)
230
+ end
231
+
227
232
  #Determine the PE package to download/upload on a mac host, download/upload that package onto the host.
228
233
  # Assumed file name format: puppet-enterprise-3.3.0-rc1-559-g97f0833-osx-10.9-x86_64.dmg.
229
234
  # @param [Host] host The mac host to download/upload and unpack PE onto
@@ -476,6 +481,8 @@ module Beaker
476
481
  # detect the kind of install we're doing
477
482
  install_type = determine_install_type(hosts, opts)
478
483
  case install_type
484
+ when :pe_managed_postgres
485
+ do_install_pe_with_pe_managed_external_postgres(hosts,opts)
479
486
  when :simple_monolithic
480
487
  simple_monolithic_install(hosts.first, hosts.drop(1), opts)
481
488
  when :simple_split
@@ -499,13 +506,16 @@ module Beaker
499
506
  # determine_install_type(hosts, {:type => :install, :pe_ver => '2017.2.0'})
500
507
  #
501
508
  # @return [Symbol]
502
- # One of :generic, :simple_monolithic, :simple_split
509
+ # One of :generic, :simple_monolithic, :simple_split, :pe_managed_postgres
503
510
  # :simple_monolithic
504
511
  # returned when installing >=2016.4 with a monolithic master and
505
512
  # any number of frictionless agents
506
513
  # :simple_split
507
514
  # returned when installing >=2016.4 with a split install and any
508
515
  # number of frictionless agents
516
+ # :pe_managed_postgres
517
+ # returned when installing PE with postgres being managed on a node
518
+ # that is different then the database node
509
519
  # :generic
510
520
  # returned for any other install or upgrade
511
521
  #
@@ -524,6 +534,8 @@ module Beaker
524
534
  :simple_monolithic
525
535
  elsif hosts[0]['roles'].include?('master') && hosts[1]['roles'].include?('database') && hosts[2]['roles'].include?('dashboard') && hosts.drop(3).all? {|host| host['roles'].include?('frictionless')}
526
536
  :simple_split
537
+ elsif hosts.any? {|host| host['roles'].include?('pe_postgres')}
538
+ :pe_managed_postgres
527
539
  else
528
540
  :generic
529
541
  end
@@ -1304,6 +1316,55 @@ module Beaker
1304
1316
  do_higgs_install higgs_host, options
1305
1317
  end
1306
1318
 
1319
+ #Installs PE with a PE managed external postgres
1320
+ def do_install_pe_with_pe_managed_external_postgres(hosts, opts)
1321
+
1322
+ is_upgrade = (original_pe_ver(hosts[0]) != hosts[0][:pe_ver])
1323
+ step "Setup tmp installer directory and pe.conf" do
1324
+
1325
+ prepare_hosts(hosts,opts)
1326
+ register_feature_flags!(opts)
1327
+ fetch_pe(hosts,opts)
1328
+
1329
+ [master, database, dashboard, pe_postgres].uniq.each do |host|
1330
+ prepare_host_installer_options(host)
1331
+
1332
+ unless is_upgrade
1333
+ setup_pe_conf(host, hosts, opts)
1334
+ end
1335
+ end
1336
+ end
1337
+
1338
+ unless is_upgrade
1339
+ step "Initial master install, expected to fail due to RBAC database not being initialized" do
1340
+ begin
1341
+ execute_installer_cmd(master, opts)
1342
+ rescue Beaker::Host::CommandFailure => e
1343
+ #The way the master fails to install includes this specific line as of PE 2018.1.x.
1344
+ unless e.message =~ /The operation could not be completed because RBACs database has not been initialized/
1345
+ raise "Install on master failed in an unexpected manner"
1346
+ end
1347
+ end
1348
+ end
1349
+ end
1350
+
1351
+ step "Install/Upgrade postgres service on pe-postgres node" do
1352
+ execute_installer_cmd(pe_postgres, opts)
1353
+ end
1354
+
1355
+ step "Finish install/upgrade on infrastructure" do
1356
+ [master, database, dashboard].uniq.each do |host|
1357
+ execute_installer_cmd(host, opts)
1358
+ end
1359
+ end
1360
+
1361
+ step "Final puppet run on infrastructure + postgres node" do
1362
+ [master, database, dashboard, pe_postgres].uniq.each do |host|
1363
+ on host, 'puppet agent -t', :acceptable_exit_codes => [0,2]
1364
+ end
1365
+ end
1366
+ end
1367
+
1307
1368
  # Grabs the pe file from a remote host to the machine running Beaker, then
1308
1369
  # scp's the file out to the host.
1309
1370
  #
@@ -1479,6 +1540,23 @@ module Beaker
1479
1540
  end
1480
1541
  end
1481
1542
 
1543
+ # Return the original pe_ver setting for the passed host.
1544
+ # Beaker resets pe_ver to the value of pe_upgrade_ver during its upgrade process.
1545
+ # If the hosts's original configuration did not have a pe_ver, return the
1546
+ # value of pe_ver set directly in options. It's the Host['pe_ver'] that
1547
+ # gets overwritten by Beaker on upgrade. So if the original host config did not
1548
+ # have a pe_ver set, there should be a pe_ver set in options and we can use
1549
+ # that.
1550
+ def original_pe_ver(host)
1551
+ options[:HOSTS][host.name][:pe_ver] || options[:pe_ver]
1552
+ end
1553
+
1554
+ # Returns the version of PE that the host will be upgraded to
1555
+ # If no upgrade is planned then just the version of PE to install is returned
1556
+ def upgrading_to_pe_ver(host)
1557
+ options[:HOSTS][host.name][:pe_upgrade_ver] || options[:pe_ver]
1558
+ end
1559
+
1482
1560
  # @return a Ruby object of any root key in pe.conf.
1483
1561
  #
1484
1562
  # @param key [String] to lookup
@@ -3,7 +3,7 @@ module Beaker
3
3
  module PE
4
4
 
5
5
  module Version
6
- STRING = '1.27.0'
6
+ STRING = '1.28.0'
7
7
  end
8
8
 
9
9
  end
@@ -1070,6 +1070,7 @@ describe ClassMixedWithDSLInstallUtils do
1070
1070
  let(:puppetdb) { make_host('puppetdb', :pe_ver => '2016.4', :roles => [ 'database' ]) }
1071
1071
  let(:console) { make_host('console', :pe_ver => '2016.4', :roles => [ 'dashboard' ]) }
1072
1072
  let(:agent) { make_host('agent', :pe_ver => '2016.4', :roles => ['frictionless']) }
1073
+ let(:pe_postgres) { make_host('pe_postgres', :pe_ver => '2016.4', :roles => [ 'pe_postgres' ]) }
1073
1074
 
1074
1075
  it 'identifies a monolithic install with frictionless agents' do
1075
1076
  hosts = [monolithic, agent, agent, agent]
@@ -1112,11 +1113,159 @@ describe ClassMixedWithDSLInstallUtils do
1112
1113
  hosts = [monolithic, master, agent, agent, agent]
1113
1114
  expect(subject.determine_install_type(hosts, {})).to eq(:generic)
1114
1115
  end
1116
+
1115
1117
  it 'identifies an install that requires windows msi install as generic' do
1116
1118
  win_agent = make_host('agent', :pe_ver => '2016.4.0', :platform => 'win-2008r2', :roles => ['frictionless'])
1117
1119
  hosts = [monolithic, agent, win_agent]
1118
1120
  expect(subject.determine_install_type(hosts, {})).to eq(:generic)
1119
1121
  end
1122
+
1123
+ it 'identifies a monolithic install with an external postgres node install as pe_managed_postgres' do
1124
+ hosts = [monolithic, pe_postgres]
1125
+ expect(subject.determine_install_type(hosts, {})).to eq(:pe_managed_postgres)
1126
+ end
1127
+
1128
+ it 'identifies a split install with an external postgres node install as pe_managed_postgres' do
1129
+ hosts = [master, puppetdb, console, pe_postgres]
1130
+ expect(subject.determine_install_type(hosts, {})).to eq(:pe_managed_postgres)
1131
+ end
1132
+ end
1133
+
1134
+ describe 'do_install_pe_with_pe_managed_external_postgres' do
1135
+ let(:mono_master) { make_host('mono_master', :pe_ver => '2017.2', :platform => 'ubuntu-16.04-x86_64', :roles => ['master', 'database', 'dashboard']) }
1136
+ let(:pe_postgres) { make_host('pe_postgres', :pe_ver => '2017.2', :platform => 'el-7-x86_64', :roles => ['pe_postgres', 'agent']) }
1137
+ let(:split_master) { make_host('mono_master', :pe_ver => '2017.2', :platform => 'ubuntu-16.04-x86_64', :roles => ['master', 'agent']) }
1138
+ let(:split_database) { make_host('split_database', :pe_ver => '2017.2', :platform => 'ubuntu-16.04-x86_64', :roles => ['database', 'agent']) }
1139
+ let(:split_console) { make_host('mono_master', :pe_ver => '2017.2', :platform => 'ubuntu-16.04-x86_64', :roles => ['dashboard', 'agent']) }
1140
+
1141
+ it 'will do a monolithic installation of PE with an external postgres that is managed by PE' do
1142
+ allow(subject).to receive(:fetch_pe).with([mono_master, pe_postgres], {}).and_return(true)
1143
+ allow(subject).to receive(:master).and_return(mono_master)
1144
+ allow(subject).to receive(:database).and_return(mono_master)
1145
+ allow(subject).to receive(:dashboard).and_return(mono_master)
1146
+ allow(subject).to receive(:pe_postgres).and_return(pe_postgres)
1147
+
1148
+ allow(subject).to receive(:original_pe_ver).and_return('2017.2')
1149
+ allow(subject).to receive(:prepare_host_installer_options).exactly(2).times
1150
+ allow(subject).to receive(:setup_pe_conf).exactly(2).times
1151
+
1152
+ #installer command on master is called twice on install
1153
+ allow(subject).to receive(:execute_installer_cmd).with(mono_master, {}).twice
1154
+ allow(subject).to receive(:execute_installer_cmd).with(pe_postgres, {}).once
1155
+
1156
+ allow(subject).to receive(:on).with(mono_master, "puppet agent -t", :acceptable_exit_codes=>[0, 2]).once
1157
+ allow(subject).to receive(:on).with(pe_postgres, "puppet agent -t", :acceptable_exit_codes=> [0, 2]).once
1158
+
1159
+ expect{ subject.do_install_pe_with_pe_managed_external_postgres([mono_master, pe_postgres], {}) }.not_to raise_error
1160
+ end
1161
+
1162
+ it 'will do a monolithic upgrade of PE with an external postgres that is managed by PE' do
1163
+ allow(subject).to receive(:fetch_pe).with([mono_master, pe_postgres], {}).and_return(true)
1164
+ allow(subject).to receive(:master).and_return(mono_master)
1165
+ allow(subject).to receive(:database).and_return(mono_master)
1166
+ allow(subject).to receive(:dashboard).and_return(mono_master)
1167
+ allow(subject).to receive(:pe_postgres).and_return(pe_postgres)
1168
+
1169
+ allow(subject).to receive(:original_pe_ver).and_return('2016.4')
1170
+ allow(subject).to receive(:prepare_host_installer_options).exactly(2).times
1171
+ allow(subject).to receive(:setup_pe_conf).exactly(2).times
1172
+
1173
+ #installer command on master is only called once on upgrade
1174
+ allow(subject).to receive(:execute_installer_cmd).with(mono_master, {}).once
1175
+ allow(subject).to receive(:execute_installer_cmd).with(pe_postgres, {}).once
1176
+
1177
+ allow(subject).to receive(:on).with(mono_master, "puppet agent -t", :acceptable_exit_codes=>[0, 2]).once
1178
+ allow(subject).to receive(:on).with(pe_postgres, "puppet agent -t", :acceptable_exit_codes=> [0, 2]).once
1179
+
1180
+ expect{ subject.do_install_pe_with_pe_managed_external_postgres([mono_master, pe_postgres], {}) }.not_to raise_error
1181
+ end
1182
+
1183
+ it 'will do a split installation of PE with an external postgres that is managed by PE' do
1184
+ allow(subject).to receive(:fetch_pe).with([split_master, split_database, split_console, pe_postgres], {}).and_return(true)
1185
+ allow(subject).to receive(:master).and_return(split_master)
1186
+ allow(subject).to receive(:database).and_return(split_database)
1187
+ allow(subject).to receive(:dashboard).and_return(split_console)
1188
+ allow(subject).to receive(:pe_postgres).and_return(pe_postgres)
1189
+
1190
+ allow(subject).to receive(:original_pe_ver).and_return('2017.2')
1191
+ allow(subject).to receive(:prepare_host_installer_options).exactly(4).times
1192
+ allow(subject).to receive(:setup_pe_conf).exactly(4).times
1193
+
1194
+ #installer command on master is called twice on install
1195
+ allow(subject).to receive(:execute_installer_cmd).with(split_master, {}).twice
1196
+ allow(subject).to receive(:execute_installer_cmd).with(split_database, {}).once
1197
+ allow(subject).to receive(:execute_installer_cmd).with(split_console, {}).once
1198
+ allow(subject).to receive(:execute_installer_cmd).with(pe_postgres, {}).once
1199
+
1200
+ allow(subject).to receive(:on).with(split_master, "puppet agent -t", :acceptable_exit_codes=>[0, 2]).once
1201
+ allow(subject).to receive(:on).with(split_database, "puppet agent -t", :acceptable_exit_codes=>[0, 2]).once
1202
+ allow(subject).to receive(:on).with(split_console, "puppet agent -t", :acceptable_exit_codes=>[0, 2]).once
1203
+ allow(subject).to receive(:on).with(pe_postgres, "puppet agent -t", :acceptable_exit_codes=> [0, 2]).once
1204
+
1205
+ expect{ subject.do_install_pe_with_pe_managed_external_postgres([split_master, split_database, split_console, pe_postgres], {}) }.not_to raise_error
1206
+ end
1207
+
1208
+ it 'will do a split upgrade of PE with an external postgres that is managed by PE' do
1209
+ allow(subject).to receive(:fetch_pe).with([split_master, split_database, split_console, pe_postgres], {}).and_return(true)
1210
+ allow(subject).to receive(:master).and_return(split_master)
1211
+ allow(subject).to receive(:database).and_return(split_database)
1212
+ allow(subject).to receive(:dashboard).and_return(split_console)
1213
+ allow(subject).to receive(:pe_postgres).and_return(pe_postgres)
1214
+
1215
+ allow(subject).to receive(:original_pe_ver).and_return('2016.4')
1216
+ allow(subject).to receive(:prepare_host_installer_options).exactly(4).times
1217
+ allow(subject).to receive(:setup_pe_conf).exactly(4).times
1218
+
1219
+ #installer command on master is called once on upgrade
1220
+ allow(subject).to receive(:execute_installer_cmd).with(split_master, {}).once
1221
+ allow(subject).to receive(:execute_installer_cmd).with(split_database, {}).once
1222
+ allow(subject).to receive(:execute_installer_cmd).with(split_console, {}).once
1223
+ allow(subject).to receive(:execute_installer_cmd).with(pe_postgres, {}).once
1224
+
1225
+ allow(subject).to receive(:on).with(split_master, "puppet agent -t", :acceptable_exit_codes=>[0, 2]).once
1226
+ allow(subject).to receive(:on).with(split_database, "puppet agent -t", :acceptable_exit_codes=>[0, 2]).once
1227
+ allow(subject).to receive(:on).with(split_console, "puppet agent -t", :acceptable_exit_codes=>[0, 2]).once
1228
+ allow(subject).to receive(:on).with(pe_postgres, "puppet agent -t", :acceptable_exit_codes=> [0, 2]).once
1229
+
1230
+ expect{ subject.do_install_pe_with_pe_managed_external_postgres([split_master, split_database, split_console, pe_postgres], {}) }.not_to raise_error
1231
+ end
1232
+ end
1233
+
1234
+ describe 'execute_installer_cmd' do
1235
+ let(:mono_master) { make_host('mono_master', :pe_installer => 'pe_installer', :working_dir => "tmp/2014-07-01_15.27.53", :pe_ver => '2017.2', :platform => 'ubuntu-16.04-x86_64', :roles => ['master', 'database', 'dashboard']) }
1236
+
1237
+ it 'will call on with the installer command on the given host' do
1238
+ allow(subject).to receive(:on).with(mono_master, "cd tmp/2014-07-01_15.27.53/ && ./pe_installer -y ")
1239
+ expect{ subject.execute_installer_cmd(mono_master, {}) }.not_to raise_error
1240
+ end
1241
+ end
1242
+
1243
+ describe 'original_pe_ver' do
1244
+ let(:master) { make_host('master', :platform => 'ubuntu-16.04-x86_64', :roles => ['master', 'database', 'dashboard']) }
1245
+
1246
+ it 'Returns the original pe ver when in upgrade situtaiton' do
1247
+ subject.options = {:HOSTS => { 'master' => {:pe_ver => '2016.4.0'}}, :pe_ver => '2017.2'}
1248
+ expect(subject.original_pe_ver(master)).to eq('2016.4.0')
1249
+ end
1250
+
1251
+ it 'Returns the only pe ver when in non-upgrade sistuation' do
1252
+ subject.options = {:HOSTS => { 'master' => {:pe_ver => '2017.2'}}, :pe_ver => '2017.2'}
1253
+ expect(subject.original_pe_ver(master)).to eq('2017.2')
1254
+ end
1255
+ end
1256
+
1257
+ describe 'upgrading_to_pe_ver' do
1258
+ let(:master) { make_host('master', :platform => 'ubuntu-16.04-x86_64', :roles => ['master', 'database', 'dashboard']) }
1259
+
1260
+ it 'Returns the upgrade pe ver when in upgrade situtaiton' do
1261
+ subject.options = {:HOSTS => { 'master' => {:pe_upgrade_ver => '2017.3'}}, :pe_ver => '2017.2'}
1262
+ expect(subject.upgrading_to_pe_ver(master)).to eq('2017.3')
1263
+ end
1264
+
1265
+ it 'Returns just pe ver when no pe_upgrade_ver is set ' do
1266
+ subject.options = {:HOSTS => { 'master' => {:pe_upgrade_ver => nil}}, :pe_ver => '2017.2'}
1267
+ expect(subject.upgrading_to_pe_ver(master)).to eq('2017.2')
1268
+ end
1120
1269
  end
1121
1270
 
1122
1271
  describe '#deploy_frictionless_to_master' do
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.27.0
4
+ version: 1.28.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-12-12 00:00:00.000000000 Z
11
+ date: 2017-12-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rspec