beaker-pe 0.1.2 → 0.2.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,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- OWZjMjMxMzZmYjc5ZWYzN2NiYmYwYmY2YzUyOWM3ZGM2YTZiZWI5MA==
4
+ ZDZkZGU0MTNmZTVjNjQ5NGM3YTk5OGFhNTNhM2IyMDFjYmQ3MmEyNg==
5
5
  data.tar.gz: !binary |-
6
- YzAwOTlhOGJhMmUzYWU1Nzg0Y2RmOWNkNGY4MWU3YjlkM2Q0ZTE5OQ==
6
+ ODE5N2ZmYTdiYzkwOGM2MTIzY2Q0MjIwMGJlNGQ5MjIxYTk5YzEzMQ==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- ZGZhOTYzNzE3MDY2YzUxNTU4ODg4ZWJkM2U4NDFkYmRjYTk3ODNjODA5OTRj
10
- MzM3ZGM4ODI5OWEyOTRmYjNkNTEzZmFlYTU5M2M5OTZmNTc0ZDYzZDYzZDQz
11
- MjY5YTZmNDA5ZDNiZTdjZDA5MzAyZWUxNTJjMDJlYTQyYTk4MjQ=
9
+ ZjZhMjJjZWI4ZTE4ZmRhYjExZjNmODdmM2Q5YzAzYTZmZGE5ZWQzMjM4ZTA3
10
+ NzNiMGQwYzZhZGRiZjc4ZjViMWViYTI3NWMwZmJjOTA5ZTlkMTIyZjVkMDIy
11
+ ZDA3NzUzMzkxZDE3NGYxMGI0ZWRhNDM1OWNhOTFiZjg2Y2UxYTA=
12
12
  data.tar.gz: !binary |-
13
- MTUzMzMwNzc3MzFiOTAzMzM1MDlkOWEyZTQ3NGYwNmQ3Y2JiNjNjMjE4YzNk
14
- ZWY0MjljM2QyYTQ3OTUxMWQzMTk5N2M1MTEzOTI4ZjZhYjE4YmE4MzNjYzYx
15
- MzVkZjdiYTlkYjgwNWMxNzAzNDQyZDkwMzA1NGM4NzZlMGQ5YjU=
13
+ NWI4NWFmYzA1YTdiMmQyNjIwNzY0ZjA0N2UwOTAzZGQxNjBhODFlZWI2OTFk
14
+ Y2I5MzY2ZWE3NDc3MTYzZTY2M2M4MGY4YzVlYjg4NmU5M2RjMzNjOTRjYTY2
15
+ M2UzNTE0MmM3MzdiY2I1OGI4OWQ4MjdjZTgyMGI1ZDdmMDg0YTI=
data/HISTORY.md CHANGED
@@ -1,11 +1,95 @@
1
1
  # default - History
2
2
  ## Tags
3
- * [LATEST - 4 Apr, 2016 (b3175863)](#LATEST)
3
+ * [LATEST - 18 May, 2016 (d9a052a4)](#LATEST)
4
+ * [0.1.2 - 4 Apr, 2016 (a6fd7bef)](#0.1.2)
4
5
  * [0.1.1 - 4 Apr, 2016 (8203d928)](#0.1.1)
5
6
  * [0.1.0 - 29 Feb, 2016 (4fc88d8c)](#0.1.0)
6
7
 
7
8
  ## Details
8
- ### <a name = "LATEST">LATEST - 4 Apr, 2016 (b3175863)
9
+ ### <a name = "LATEST">LATEST - 18 May, 2016 (d9a052a4)
10
+
11
+ * (GEM) update beaker-pe version to 0.2.0 (d9a052a4)
12
+
13
+ * Merge pull request #1 from Renelast/fix/windows_masterless (ef4be9a2)
14
+
15
+
16
+ ```
17
+ Merge pull request #1 from Renelast/fix/windows_masterless
18
+
19
+ Fixes windows masterless installation
20
+ ```
21
+ * Merge branch 'master' of https://github.com/puppetlabs/beaker-pe into fix/windows_masterless (f1a96fb2)
22
+
23
+ * Merge pull request #7 from tvpartytonight/BKR-656 (aa566657)
24
+
25
+
26
+ ```
27
+ Merge pull request #7 from tvpartytonight/BKR-656
28
+
29
+ (maint) Remove leftover comments
30
+ ```
31
+ * (maint) Remove leftover comments (c7ce982b)
32
+
33
+
34
+ ```
35
+ (maint) Remove leftover comments
36
+
37
+ This removes some straggling comments and adds a comment to the new
38
+ metadata object in the `ClassMixedWithDSLInstallUtils` class.
39
+ ```
40
+ * Merge pull request #6 from tvpartytonight/BKR-656 (c1ea366b)
41
+
42
+
43
+ ```
44
+ Merge pull request #6 from tvpartytonight/BKR-656
45
+
46
+ BKR-656
47
+ ```
48
+ * (BKR-656) refactor pe_ver setting into independent method (0d918c46)
49
+
50
+
51
+ ```
52
+ (BKR-656) refactor pe_ver setting into independent method
53
+
54
+ Previous to this commit, transforming a host object prior to upgrading
55
+ was handled in the upgrade_pe_on method. This change removes that logic
56
+ from that method and allows for independent transformation to happen in
57
+ a new prep_host_for_upgrade method.
58
+ ```
59
+ * (BKR-656) Update spec tests for do_install (b602661f)
60
+
61
+
62
+ ```
63
+ (BKR-656) Update spec tests for do_install
64
+
65
+ Commit 7112971ac7b14b8c3e9703523bbb8526af6fdfbe introduced changes to
66
+ the do_install method but did not have any updates for the spec tests.
67
+ This commit adds those tests in.
68
+ ```
69
+ * Adds type defaults and runs puppet agent on masterless windows (e7d06a3f)
70
+
71
+ * Fixes windows masterless installation (9ff54261)
72
+
73
+
74
+ ```
75
+ Fixes windows masterless installation
76
+
77
+ Setting up a masterless windows client would fail with the following error:
78
+
79
+ Exited: 1
80
+ /usr/local/rvm/gems/ruby-2.2.1/gems/beaker-2.37.0/lib/beaker/host.rb:330:in `exec': Host 'sxrwjhkia9gzo03' exited with 1 running: (Beaker::Host::CommandFailure)
81
+ cmd.exe /c puppet config set server
82
+ Last 10 lines of output were:
83
+ Error: puppet config set takes 2 arguments, but you gave 1
84
+ Error: Try 'puppet help config set' for usage
85
+
86
+ As far as I could see this error is caused by the 'setup_defaults_and_config_helper_on' function which tries to set the master configuration setting in puppet.conf. But since there is no master varaible available this failes.
87
+
88
+ This patch should fix that by only calling setup_defaults_and_config_helper_on whern we're not doing a masterless installation.
89
+ ```
90
+ ### <a name = "0.1.2">0.1.2 - 4 Apr, 2016 (a6fd7bef)
91
+
92
+ * (HISTORY) update beaker-pe history for gem release 0.1.2 (a6fd7bef)
9
93
 
10
94
  * (GEM) update beaker-pe version to 0.1.2 (b3175863)
11
95
 
@@ -410,7 +410,12 @@ module Beaker
410
410
 
411
411
  # 1 since no certificate found and waitforcert disabled
412
412
  acceptable_exit_codes = 1
413
- setup_defaults_and_config_helper_on(host, master, acceptable_exit_codes)
413
+ if masterless
414
+ configure_type_defaults_on(host)
415
+ on host, puppet_agent('-t'), :acceptable_exit_codes => acceptable_exit_codes
416
+ else
417
+ setup_defaults_and_config_helper_on(host, master, acceptable_exit_codes)
418
+ end
414
419
  else
415
420
  # We only need answers if we're using the classic installer
416
421
  version = host['pe_ver'] || opts[:pe_ver]
@@ -634,23 +639,36 @@ module Beaker
634
639
  end
635
640
  # get new version information
636
641
  hosts.each do |host|
637
- host['pe_dir'] = host['pe_upgrade_dir'] || path
638
- if host['platform'] =~ /windows/
639
- host['pe_ver'] = host['pe_upgrade_ver'] || opts['pe_upgrade_ver'] ||
640
- Options::PEVersionScraper.load_pe_version(host['pe_dir'], opts[:pe_version_file_win])
641
- else
642
- host['pe_ver'] = host['pe_upgrade_ver'] || opts['pe_upgrade_ver'] ||
643
- Options::PEVersionScraper.load_pe_version(host['pe_dir'], opts[:pe_version_file])
644
- end
645
- if version_is_less(host['pe_ver'], '3.0')
646
- host['pe_installer'] ||= 'puppet-enterprise-upgrader'
647
- end
642
+ prep_host_for_upgrade(host, opts, path)
648
643
  end
649
644
  do_install(sorted_hosts, opts.merge({:type => :upgrade, :set_console_password => set_console_password}))
650
645
  opts['upgrade'] = true
651
646
  end
652
647
  end
653
648
 
649
+ #Prep a host object for upgrade; used inside upgrade_pe_on
650
+ # @param [Host] host A single host object to prepare for upgrade
651
+ # !macro common_opts
652
+ # @param [String] path A path (either local directory or a URL to a listing of PE builds).
653
+ # Will contain a LATEST file indicating the latest build to install.
654
+ # This is ignored if a pe_upgrade_ver and pe_upgrade_dir are specified
655
+ # in the host configuration file.
656
+ # @example
657
+ # prep_host_for_upgrade(master, {}, "http://neptune.puppetlabs.lan/3.0/ci-ready/")
658
+ def prep_host_for_upgrade(host, opts={}, path='')
659
+ host['pe_dir'] = host['pe_upgrade_dir'] || path
660
+ if host['platform'] =~ /windows/
661
+ host['pe_ver'] = host['pe_upgrade_ver'] || opts['pe_upgrade_ver'] ||
662
+ Options::PEVersionScraper.load_pe_version(host['pe_dir'], opts[:pe_version_file_win])
663
+ else
664
+ host['pe_ver'] = host['pe_upgrade_ver'] || opts['pe_upgrade_ver'] ||
665
+ Options::PEVersionScraper.load_pe_version(host['pe_dir'], opts[:pe_version_file])
666
+ end
667
+ if version_is_less(host['pe_ver'], '3.0')
668
+ host['pe_installer'] ||= 'puppet-enterprise-upgrader'
669
+ end
670
+ end
671
+
654
672
  #Create the Higgs install command string based upon the host and options settings. Installation command will be run as a
655
673
  #background process. The output of the command will be stored in the provided host['higgs_file'].
656
674
  # @param [Host] host The host that Higgs is to be installed on
@@ -3,7 +3,7 @@ module Beaker
3
3
  module PE
4
4
 
5
5
  module Version
6
- STRING = '0.1.2'
6
+ STRING = '0.2.0'
7
7
  end
8
8
 
9
9
  end
@@ -12,6 +12,12 @@ class ClassMixedWithDSLInstallUtils
12
12
 
13
13
  attr_accessor :hosts
14
14
 
15
+ # Because some the methods now actually call out to the `step` method, we need to
16
+ # mock out `metadata` that is initialized in a test case.
17
+ def metadata
18
+ @metadata ||= {}
19
+ end
20
+
15
21
  def logger
16
22
  @logger ||= RSpec::Mocks::Double.new('logger').as_null_object
17
23
  end
@@ -48,6 +54,44 @@ describe ClassMixedWithDSLInstallUtils do
48
54
  :type => 'pe',
49
55
  :working_dir => '/tmp',
50
56
  :dist => 'puppet-enterprise-3.7.1-rc0-78-gffc958f-eos-4-i386' } ) }
57
+
58
+ context '#prep_host_for_upgrade' do
59
+
60
+ it 'sets per host options before global options' do
61
+ opts['pe_upgrade_ver'] = 'options-specific-var'
62
+ hosts.each do |host|
63
+ host['pe_upgrade_dir'] = 'host-specific-pe-dir'
64
+ host['pe_upgrade_ver'] = 'host-specific-pe-ver'
65
+ subject.prep_host_for_upgrade(host, opts, 'argument-specific-pe-dir')
66
+ expect(host['pe_dir']).to eq('host-specific-pe-dir')
67
+ expect(host['pe_ver']).to eq('host-specific-pe-ver')
68
+ end
69
+ end
70
+
71
+ it 'sets global options when no host options are available' do
72
+ opts['pe_upgrade_ver'] = 'options-specific-var'
73
+ hosts.each do |host|
74
+ host['pe_upgrade_dir'] = nil
75
+ host['pe_upgrade_ver'] = nil
76
+ subject.prep_host_for_upgrade(host, opts, 'argument-specific-pe-dir')
77
+ expect(host['pe_dir']).to eq('argument-specific-pe-dir')
78
+ expect(host['pe_ver']).to eq('options-specific-var')
79
+ end
80
+ end
81
+
82
+ it 'calls #load_pe_version when neither global or host options are present' do
83
+ opts['pe_upgrade_ver'] = nil
84
+ hosts.each do |host|
85
+ host['pe_upgrade_dir'] = nil
86
+ host['pe_upgrade_ver'] = nil
87
+ expect( Beaker::Options::PEVersionScraper ).to receive(:load_pe_version).and_return('file_version')
88
+ subject.prep_host_for_upgrade(host, opts, 'argument-specific-pe-dir')
89
+ expect(host['pe_ver']).to eq('file_version')
90
+ expect(host['pe_dir']).to eq('argument-specific-pe-dir')
91
+ end
92
+ end
93
+ end
94
+
51
95
  context '#configure_pe_defaults_on' do
52
96
  it 'uses aio paths for hosts of role aio' do
53
97
  hosts.each do |host|
@@ -355,6 +399,8 @@ describe ClassMixedWithDSLInstallUtils do
355
399
  allow( subject ).to receive( :version_is_less ).with('3.0', '3.0').and_return( false )
356
400
  allow( subject ).to receive( :version_is_less ).with('3.0', '3.99').and_return( true )
357
401
  allow( subject ).to receive( :version_is_less ).with('3.99', '3.0').and_return( false )
402
+ allow( subject ).to receive( :check_puppetdb_status_endpoint ).and_return( nil )
403
+ allow( subject ).to receive( :version_is_less ).with('3.0', '2016.1.0').and_return( false )
358
404
  allow( subject ).to receive( :wait_for_host_in_dashboard ).and_return( true )
359
405
  allow( subject ).to receive( :puppet_agent ) do |arg|
360
406
  "puppet agent #{arg}"
@@ -390,19 +436,16 @@ describe ClassMixedWithDSLInstallUtils do
390
436
  expect( subject ).to receive( :stop_agent_on ).with( hosts[1] ).once
391
437
  expect( subject ).to receive( :stop_agent_on ).with( hosts[2] ).once
392
438
  expect( subject ).to receive( :stop_agent_on ).with( hosts[3] ).once
393
- #wait for puppetdb to start
394
- expect( subject ).to receive( :sleep_until_puppetdb_started ).with( hosts[0] ).once
395
- #run each puppet agent once
396
- expect( subject ).to receive( :on ).with( hosts[0], /puppet agent -t/, :acceptable_exit_codes => [0,2] ).once
397
- expect( subject ).to receive( :on ).with( hosts[1], /puppet agent -t/, :acceptable_exit_codes => [0,2] ).once
398
- expect( subject ).to receive( :on ).with( hosts[2], /puppet agent -t/, :acceptable_exit_codes => [0,2] ).once
399
- expect( subject ).to receive( :on ).with( hosts[3], /puppet agent -t/, :acceptable_exit_codes => [0,2] ).once
439
+ # We wait for puppetdb to restart 3 times; once before the first puppet run, and then during each puppet run
440
+ expect( subject ).to receive( :sleep_until_puppetdb_started ).with( hosts[0] ).exactly(3).times
441
+ # Each puppet agent runs twice, once for the initial run, and once to configure mcollective
442
+ expect( subject ).to receive( :on ).with( hosts[0], /puppet agent -t/, :acceptable_exit_codes => [0,2] ).twice
443
+ expect( subject ).to receive( :on ).with( hosts[1], /puppet agent -t/, :acceptable_exit_codes => [0,2] ).twice
444
+ expect( subject ).to receive( :on ).with( hosts[2], /puppet agent -t/, :acceptable_exit_codes => [0,2] ).twice
445
+ expect( subject ).to receive( :on ).with( hosts[3], /puppet agent -t/, :acceptable_exit_codes => [0,2] ).twice
400
446
  #run rake task on dashboard
401
447
 
402
448
  expect( subject ).to receive( :on ).with( hosts[0], /\/opt\/puppet\/bin\/rake -sf \/opt\/puppet\/share\/puppet-dashboard\/Rakefile .* RAILS_ENV=production/ ).once
403
- #wait for all hosts to appear in the dashboard
404
- #run puppet agent now that installation is complete
405
- expect( subject ).to receive( :on ).with( hosts, /puppet agent/, :acceptable_exit_codes => [0,2] ).once
406
449
 
407
450
  hosts.each do |host|
408
451
  allow( host ).to receive( :tmpdir )
@@ -469,6 +512,8 @@ describe ClassMixedWithDSLInstallUtils do
469
512
  allow( subject ).to receive( :version_is_less ).with('3.99', '4.0').and_return( true )
470
513
  # pe_ver is only set on the hosts for this test, not the opt
471
514
  allow( subject ).to receive( :version_is_less ).with('4.0', '3.99').and_return( true )
515
+ allow( subject ).to receive( :version_is_less ).with('4.0', '2016.1.0').and_return( false )
516
+ allow( subject ).to receive( :check_puppetdb_status_endpoint ).and_return( nil )
472
517
  allow( subject ).to receive( :wait_for_host_in_dashboard ).and_return( true )
473
518
  allow( subject ).to receive( :puppet_agent ) do |arg|
474
519
  "puppet agent #{arg}"
@@ -490,12 +535,11 @@ describe ClassMixedWithDSLInstallUtils do
490
535
  expect( subject ).to receive( :configure_type_defaults_on ).with( host ).once
491
536
  expect( subject ).to receive( :sign_certificate_for ).with( host ).once
492
537
  expect( subject ).to receive( :stop_agent_on ).with( host ).once
493
- expect( subject ).to receive( :on ).with( host, /puppet agent -t/, :acceptable_exit_codes => [0,2] ).once
538
+ # Each puppet agent runs twice, once for the initial run, and once to configure mcollective
539
+ expect( subject ).to receive( :on ).with( host, /puppet agent -t/, :acceptable_exit_codes => [0,2] ).twice
494
540
  end
495
- #wait for puppetdb to start
496
- expect( subject ).to receive( :sleep_until_puppetdb_started ).with( hosts[0] ).once#wait for all hosts to appear in the dashboard
497
- #run puppet agent now that installation is complete
498
- expect( subject ).to receive( :on ).with( hosts, /puppet agent/, :acceptable_exit_codes => [0,2] ).once
541
+ # We wait for puppetdb to restart 3 times; once before the first puppet run, and then during each puppet run
542
+ expect( subject ).to receive( :sleep_until_puppetdb_started ).with( hosts[0] ).exactly(3).times
499
543
 
500
544
  hosts.each do |host|
501
545
  allow( host ).to receive( :tmpdir )
@@ -530,6 +574,8 @@ describe ClassMixedWithDSLInstallUtils do
530
574
  allow( subject ).to receive( :version_is_less ).with('3.99', '4.0').and_return( true )
531
575
  allow( subject ).to receive( :version_is_less ).with('3.8', '4.0').and_return( true )
532
576
  # pe_ver is only set on the hosts for this test, not the opt
577
+ allow( subject ).to receive( :version_is_less ).with('4.0', '2016.1.0').and_return( false )
578
+ allow( subject ).to receive( :check_puppetdb_status_endpoint ).and_return( nil )
533
579
  allow( subject ).to receive( :version_is_less ).with('4.0', '3.99').and_return( true )
534
580
  allow( subject ).to receive( :wait_for_host_in_dashboard ).and_return( true )
535
581
  allow( subject ).to receive( :puppet_agent ) do |arg|
@@ -551,12 +597,11 @@ describe ClassMixedWithDSLInstallUtils do
551
597
  expect( subject ).to receive( :configure_type_defaults_on ).with( host ).once
552
598
  expect( subject ).to receive( :sign_certificate_for ).with( host ).once
553
599
  expect( subject ).to receive( :stop_agent_on ).with( host ).once
554
- expect( subject ).to receive( :on ).with( host, /puppet agent -t/, :acceptable_exit_codes => [0,2] ).once
600
+ # Each puppet agent runs twice, once for the initial run, and once to configure mcollective
601
+ expect( subject ).to receive( :on ).with( host, /puppet agent -t/, :acceptable_exit_codes => [0,2] ).twice
555
602
  end
556
- #wait for puppetdb to start
557
- expect( subject ).to receive( :sleep_until_puppetdb_started ).with( hosts[0] ).once#wait for all hosts to appear in the dashboard
558
- #run puppet agent now that installation is complete
559
- expect( subject ).to receive( :on ).with( hosts, /puppet agent/, :acceptable_exit_codes => [0,2] ).once
603
+ # We wait for puppetdb to restart 3 times; once before the first puppet run, and then during each puppet run
604
+ expect( subject ).to receive( :sleep_until_puppetdb_started ).with( hosts[0] ).exactly(3).times
560
605
 
561
606
  hosts.each do |host|
562
607
  allow( host ).to receive( :tmpdir )
@@ -590,6 +635,8 @@ describe ClassMixedWithDSLInstallUtils do
590
635
  allow( subject ).to receive( :version_is_less ).with('3.8', '4.0').and_return( true )
591
636
  # pe_ver is only set on the hosts for this test, not the opt
592
637
  allow( subject ).to receive( :version_is_less ).with('4.0', '3.99').and_return( true )
638
+ allow( subject ).to receive( :version_is_less ).with('4.0', '2016.1.0').and_return( false )
639
+ allow( subject ).to receive( :check_puppetdb_status_endpoint ).and_return( nil )
593
640
  allow( subject ).to receive( :wait_for_host_in_dashboard ).and_return( true )
594
641
  allow( subject ).to receive( :puppet_agent ) do |arg|
595
642
  "puppet agent #{arg}"
@@ -610,12 +657,13 @@ describe ClassMixedWithDSLInstallUtils do
610
657
  allow( subject ).to receive( :add_pe_defaults_on ).with( host ) unless subject.aio_version?(host)
611
658
  allow( subject ).to receive( :sign_certificate_for ).with( host )
612
659
  allow( subject ).to receive( :stop_agent_on ).with( host )
660
+ # Each puppet agent runs twice, once for the initial run, and once to configure mcollective
613
661
  allow( subject ).to receive( :on ).with( host, /puppet agent -t/, :acceptable_exit_codes => [0,2] )
614
662
  end
615
- #wait for puppetdb to start
616
- allow( subject ).to receive( :sleep_until_puppetdb_started ).with( hosts[0] ) #wait for all hosts to appear in the dashboard
663
+ # We wait for puppetdb to restart 3 times; once before the first puppet run, and then during each puppet run
664
+ allow( subject ).to receive( :sleep_until_puppetdb_started ).with( hosts[0] ).exactly(3).times
617
665
  #run puppet agent now that installation is complete
618
- allow( subject ).to receive( :on ).with( hosts, /puppet agent/, :acceptable_exit_codes => [0,2] )
666
+ allow( subject ).to receive( :on ).with( hosts, /puppet agent/, :acceptable_exit_codes => [0,2] ).twice
619
667
 
620
668
  opts[:type] = :upgrade
621
669
  expect( subject ).to receive( :setup_defaults_and_config_helper_on ).with( hosts[1], hosts[0], [0, 1, 2] )
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: 0.1.2
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Puppetlabs
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-04-05 00:00:00.000000000 Z
11
+ date: 2016-05-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rspec