beaker-pe 1.39.0 → 1.40.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: bc167d062d00e928c3edab27aba88917f54740c0
4
- data.tar.gz: be559e84df01d94b0476d6cd8ffa016f8e9a553e
3
+ metadata.gz: e428e5636faf6924ded6d1c00c1025cb31f5908f
4
+ data.tar.gz: 89c7cab90ff40da8ae815a3c691a09bd25871daf
5
5
  SHA512:
6
- metadata.gz: 4be7886aef369fad8961946989a0f62e8de2a27fce265d23067fcaa8226b06b0d6988611e3f8fca5ae4300e76a51f52e7fdd6ea6d560185ace4b2c6c65e26e1d
7
- data.tar.gz: ad0d95afca16cb36b9d7c492d29d2430ce002d2298cac88d328d107f53542e9cf7359daed05117b4a6d8d777140d77cd0de0dcb7988c23f6532906d66d9982df
6
+ metadata.gz: 27c581db08eb597e2d9064e6822d9240047c1e0800dfb61b64825dd0f460b4de4f489f52a6948e7472adaff4eb4cdbe4a96e838b3e6a616f29276bf632c7dbbc
7
+ data.tar.gz: 1380918dbc0c4ac49d44a672bafb0c4c7a6735d5bc53c992f8b6f1e6bf4b2c2f2d8f7e60be78f9bac2f3a5196dfb2eba8114ac2343cf1fdb5a00a9a12a3a970d
@@ -20,7 +20,7 @@ module Beaker::DSL::InstallUtils
20
20
  # }
21
21
  # }
22
22
  #
23
- # All flag keys are expected to be downcased with hyphens.
23
+ # All flag keys are expected to be downcased with underscores.
24
24
  #
25
25
  # Environment variables may be uppercased.
26
26
  class FeatureFlags
@@ -28,12 +28,15 @@ module Beaker
28
28
  MEEP_CUTOVER_VERSION = '2016.2.0'
29
29
  # Version of PE when we switched to using meep for classification
30
30
  # instead of PE node groups
31
- MEEP_CLASSIFICATION_VERSION = '2017.2.0'
31
+ MEEP_CLASSIFICATION_VERSION = '2018.2.0'
32
32
  # PE-18799 temporary default used for meep classification check while
33
33
  # we navigate the switchover.
34
34
  # PE-18718 switch flag to true once beaker-pe, beaker-answers,
35
35
  # beaker-pe-large-environments and pe_acceptance_tests are ready
36
36
  DEFAULT_MEEP_CLASSIFICATION = false
37
+ # Version of PE in which PE is managing the agent service
38
+ MANAGE_PUPPET_SERVICE_VERSION = '2018.1.0'
39
+
37
40
  MEEP_DATA_DIR = '/etc/puppetlabs/enterprise'
38
41
  PE_CONF_FILE = "#{MEEP_DATA_DIR}/conf.d/pe.conf"
39
42
  NODE_CONF_PATH = "#{MEEP_DATA_DIR}/conf.d/nodes"
@@ -394,7 +397,9 @@ module Beaker
394
397
  def deploy_frictionless_to_master(host)
395
398
  return if use_meep_for_classification?(master[:pe_ver], options)
396
399
 
397
- platform = host['platform']
400
+ # For some platforms (e.g, redhatfips), packaging_platfrom is set and should
401
+ # be used as the primary source of truth for the platform string.
402
+ platform = host['packaging_platform'] || host['platform']
398
403
 
399
404
  # We don't have a separate AIX 7.2 build, so it is
400
405
  # classified as 7.1 for pe_repo purposes
@@ -605,6 +610,7 @@ module Beaker
605
610
  prepare_hosts(all_hosts, opts)
606
611
  fetch_pe([master], opts)
607
612
  prepare_host_installer_options(master)
613
+ register_feature_flags!(opts)
608
614
  generate_installer_conf_file_for(master, all_hosts, opts)
609
615
  step "Install PE on master" do
610
616
  on master, installer_cmd(master, opts)
@@ -614,6 +620,10 @@ module Beaker
614
620
  stop_agent_on(master)
615
621
  end
616
622
 
623
+ if manage_puppet_service?(master[:pe_ver], options)
624
+ configure_puppet_agent_service(:ensure => 'stopped', :enabled => false)
625
+ end
626
+
617
627
  step "Run puppet to setup mcollective and pxp-agent" do
618
628
  on(master, puppet_agent('-t'), :acceptable_exit_codes => [0,2])
619
629
  end
@@ -812,8 +822,7 @@ module Beaker
812
822
  on dashboard, "/opt/puppet/bin/rake -sf /opt/puppet/share/puppet-dashboard/Rakefile #{task} RAILS_ENV=production"
813
823
  end
814
824
 
815
- # PE-18799 replace the version_is_less with a use_meep_for_classification? test
816
- if use_meep_for_classification?(master[:pe_ver], options)
825
+ if manage_puppet_service?(master[:pe_ver], options)
817
826
  configure_puppet_agent_service(:ensure => 'stopped', :enabled => false)
818
827
  end
819
828
 
@@ -955,13 +964,33 @@ module Beaker
955
964
  on non_infrastructure, puppet_agent('-t'), :acceptable_exit_codes => [0,2], :run_in_parallel => true
956
965
  end
957
966
 
967
+ # Whether or not PE should be managing the puppet service on agents.
968
+ # Puppet code to manage the puppet service was added to the next branches
969
+ # and is slated to be merged into 2018.1.x
970
+ #
971
+ # Returns true if the version we are managing is greater than or equal to
972
+ # MANAGE_PUPPET_SERVICE_VERSION.
973
+ #
974
+ # Temporarily, (until merged from 'next' branches into 2018.1.x), also checks
975
+ # the pe_modules_next flag to know whether or not the code for managing puppet
976
+ # service is present.
977
+ def manage_puppet_service?(version, opts)
978
+ # PE-23651 remove vv
979
+ register_feature_flags!(opts)
980
+
981
+ temporary_flag = !!feature_flag?('pe_modules_next', opts)
982
+ # ^^
983
+
984
+ !version_is_less(version, MANAGE_PUPPET_SERVICE_VERSION) && temporary_flag
985
+ end
986
+
958
987
  # True if version is greater than or equal to MEEP_CLASSIFICATION_VERSION
959
988
  # (PE-18718) AND the temporary feature flag is true.
960
989
  #
961
- # The temporary feature flag is pe_modules_next and can be set in
990
+ # The temporary feature flag is meep_classification and can be set in
962
991
  # the :answers hash given in beaker's host.cfg, inside a feature_flags
963
992
  # hash. It will also be picked up from the environment as
964
- # PE_MODULES_NEXT. (See register_feature_flags!())
993
+ # MEEP_CLASSIFICATION. (See register_feature_flags!())
965
994
  #
966
995
  # The :answers hash value will take precedence over the env variable.
967
996
  #
@@ -973,7 +1002,7 @@ module Beaker
973
1002
  # PE-19470 remove vv
974
1003
  register_feature_flags!(opts)
975
1004
 
976
- temporary_flag = feature_flag?('pe_modules_next', opts)
1005
+ temporary_flag = feature_flag?('meep_classification', opts)
977
1006
  temporary_flag = DEFAULT_MEEP_CLASSIFICATION if temporary_flag.nil?
978
1007
  # ^^
979
1008
 
@@ -1039,8 +1068,13 @@ module Beaker
1039
1068
 
1040
1069
  modified_opts = opts.merge(beaker_answers_opts)
1041
1070
 
1042
- if feature_flag?('pe_modules_next', opts) && !modified_opts.include?(:meep_schema_version)
1043
- modified_opts[:meep_schema_version] = '2.0'
1071
+ answers_hash = modified_opts[:answers] ||= {}
1072
+ if !answers_hash.include?(:meep_schema_version)
1073
+ if feature_flag?(:meep_classification, opts)
1074
+ answers_hash[:meep_schema_version] = '2.0'
1075
+ elsif use_meep?(host['pe_ver'])
1076
+ answers_hash[:meep_schema_version] = '1.0'
1077
+ end
1044
1078
  end
1045
1079
 
1046
1080
  modified_opts
@@ -1520,7 +1554,7 @@ module Beaker
1520
1554
  get_console_dispatcher_for_beaker_pe(true)
1521
1555
  end
1522
1556
 
1523
- # In PE versions >= 2017.1.0, allows you to configure the puppet agent
1557
+ # In PE versions >= 2018.1.0, allows you to configure the puppet agent
1524
1558
  # service for all nodes.
1525
1559
  #
1526
1560
  # @param parameters [Hash] - agent profile parameters
@@ -1531,7 +1565,7 @@ module Beaker
1531
1565
  # enabled (for restarts)
1532
1566
  # @raise [StandardError] if master version is less than 2017.1.0
1533
1567
  def configure_puppet_agent_service(parameters)
1534
- raise(StandardError, "Can only manage puppet service in PE versions >= 2017.1.0; tried for #{master['pe_ver']}") if version_is_less(master['pe_ver'], '2017.1.0')
1568
+ raise(StandardError, "Can only manage puppet service in PE versions >= #{MANAGE_PUPPET_SERVICE_VERSION}; tried for #{master['pe_ver']}") if version_is_less(master['pe_ver'], MANAGE_PUPPET_SERVICE_VERSION)
1535
1569
  puppet_managed = parameters.include?(:managed) ? parameters[:managed] : true
1536
1570
  puppet_ensure = parameters[:ensure]
1537
1571
  puppet_enabled = parameters[:enabled]
@@ -1543,30 +1577,17 @@ module Beaker
1543
1577
  step msg do
1544
1578
  # PE-18799 and remove this conditional
1545
1579
  if use_meep_for_classification?(master[:pe_ver], options)
1546
- group_name = 'Puppet Enterprise Agent'
1547
1580
  class_name = 'pe_infrastructure::agent'
1548
1581
  else
1549
- group_name = 'PE Agent'
1550
1582
  class_name = 'puppet_enterprise::profile::agent'
1551
1583
  end
1552
1584
 
1553
1585
  # update pe conf
1554
- # only the pe_infrastructure::agent parameters are relevant in pe.conf
1555
1586
  update_pe_conf({
1556
- "pe_infrastructure::agent::puppet_service_managed" => puppet_managed,
1557
- "pe_infrastructure::agent::puppet_service_ensure" => puppet_ensure,
1558
- "pe_infrastructure::agent::puppet_service_enabled" => puppet_enabled,
1587
+ "#{class_name}::puppet_service_managed" => puppet_managed,
1588
+ "#{class_name}::puppet_service_ensure" => puppet_ensure,
1589
+ "#{class_name}::puppet_service_enabled" => puppet_enabled,
1559
1590
  })
1560
-
1561
- if _console_dispatcher = get_console_dispatcher_for_beaker_pe
1562
- agent_group = _console_dispatcher.get_node_group_by_name(group_name)
1563
- agent_class = agent_group['classes'][class_name]
1564
- agent_class['puppet_service_managed'] = puppet_managed
1565
- agent_class['puppet_service_ensure'] = puppet_ensure
1566
- agent_class['puppet_service_enabled'] = puppet_enabled
1567
-
1568
- _console_dispatcher.update_node_group(agent_group['id'], agent_group)
1569
- end
1570
1591
  end
1571
1592
  end
1572
1593
 
@@ -3,7 +3,7 @@ module Beaker
3
3
  module PE
4
4
 
5
5
  module Version
6
- STRING = '1.39.0'
6
+ STRING = '1.40.0'
7
7
  end
8
8
 
9
9
  end
@@ -605,14 +605,14 @@ describe ClassMixedWithDSLInstallUtils do
605
605
  end
606
606
  end
607
607
 
608
- describe 'use_meep_for_classification?' do
608
+ RSpec.shared_examples 'test flag' do |flag_name|
609
609
  let(:feature_flag) { nil }
610
610
  let(:environment_feature_flag) { nil }
611
611
  let(:answers) do
612
612
  {
613
613
  :answers => {
614
614
  'feature_flags' => {
615
- 'pe_modules_next' => feature_flag,
615
+ flag_name => feature_flag,
616
616
  },
617
617
  },
618
618
  }
@@ -627,60 +627,76 @@ describe ClassMixedWithDSLInstallUtils do
627
627
  before(:each) do
628
628
  subject.options = options
629
629
  if !environment_feature_flag.nil?
630
- ENV['PE_MODULES_NEXT'] = environment_feature_flag
630
+ ENV[flag_name.upcase] = environment_feature_flag
631
631
  end
632
632
  end
633
633
 
634
634
  after(:each) do
635
- ENV.delete('PE_MODULES_NEXT')
635
+ ENV.delete(flag_name.upcase)
636
636
  end
637
637
 
638
- it { expect(subject.use_meep_for_classification?('2017.1.0', options)).to eq(false) }
639
- it { expect(subject.use_meep_for_classification?('2017.2.0', options)).to eq(false) }
638
+ it { expect(subject.send(method, old_behavior_version, options)).to eq(false) }
639
+ it { expect(subject.send(method, threshold_version, options)).to eq(false) }
640
640
 
641
641
  context 'feature flag false' do
642
642
  let(:feature_flag) { false }
643
643
 
644
- it { expect(subject.use_meep_for_classification?('2017.1.0', options)).to eq(false) }
645
- it { expect(subject.use_meep_for_classification?('2017.2.0', options)).to eq(false) }
644
+ it { expect(subject.send(method, old_behavior_version, options)).to eq(false) }
645
+ it { expect(subject.send(method, threshold_version, options)).to eq(false) }
646
646
  end
647
647
 
648
648
  context 'feature flag true' do
649
649
  let(:feature_flag) { true }
650
650
 
651
- it { expect(subject.use_meep_for_classification?('2017.1.0', options)).to eq(false) }
652
- it { expect(subject.use_meep_for_classification?('2017.2.0', options)).to eq(true) }
651
+ it { expect(subject.send(method, old_behavior_version, options)).to eq(false) }
652
+ it { expect(subject.send(method, threshold_version, options)).to eq(true) }
653
653
  end
654
654
 
655
655
  context 'environment feature flag true' do
656
656
  let(:environment_feature_flag) { 'true' }
657
657
 
658
- it { expect(subject.use_meep_for_classification?('2017.1.0', options)).to eq(false) }
659
- it { expect(subject.use_meep_for_classification?('2017.2.0', options)).to eq(true) }
658
+ it { expect(subject.send(method, old_behavior_version, options)).to eq(false) }
659
+ it { expect(subject.send(method, threshold_version, options)).to eq(true) }
660
660
 
661
661
  context 'answers feature flag false' do
662
662
  let(:feature_flag) { false }
663
663
 
664
- it { expect(subject.use_meep_for_classification?('2017.1.0', options)).to eq(false) }
665
- it { expect(subject.use_meep_for_classification?('2017.2.0', options)).to eq(false) }
664
+ it { expect(subject.send(method, old_behavior_version, options)).to eq(false) }
665
+ it { expect(subject.send(method, threshold_version, options)).to eq(false) }
666
666
  end
667
667
  end
668
668
 
669
669
  context 'environment feature flag false' do
670
670
  let(:environment_feature_flag) { 'false' }
671
671
 
672
- it { expect(subject.use_meep_for_classification?('2017.1.0', options)).to eq(false) }
673
- it { expect(subject.use_meep_for_classification?('2017.2.0', options)).to eq(false) }
672
+ it { expect(subject.send(method, old_behavior_version, options)).to eq(false) }
673
+ it { expect(subject.send(method, threshold_version, options)).to eq(false) }
674
674
 
675
675
  context 'answers feature flag true' do
676
676
  let(:feature_flag) { true }
677
677
 
678
- it { expect(subject.use_meep_for_classification?('2017.1.0', options)).to eq(false) }
679
- it { expect(subject.use_meep_for_classification?('2017.2.0', options)).to eq(true) }
678
+ it { expect(subject.send(method, old_behavior_version, options)).to eq(false) }
679
+ it { expect(subject.send(method, threshold_version, options)).to eq(true) }
680
680
  end
681
681
  end
682
682
  end
683
683
 
684
+ describe 'use_meep_for_classification?' do
685
+ let(:old_behavior_version) { '2018.1.0' }
686
+ let(:threshold_version) { '2018.2.0' }
687
+ let(:method) { 'use_meep_for_classification?' }
688
+
689
+ include_examples('test flag', 'meep_classification')
690
+ end
691
+
692
+ describe 'manage_puppet_service?' do
693
+ let(:old_behavior_version) { '2017.3.0' }
694
+ let(:threshold_version) { '2018.1.0' }
695
+ let(:method) { 'manage_puppet_service?' }
696
+
697
+ include_examples('test flag', 'pe_modules_next')
698
+ end
699
+
684
700
  describe 'generate_installer_conf_file_for' do
685
701
  let(:master) { hosts.first }
686
702
 
@@ -814,6 +830,7 @@ describe ClassMixedWithDSLInstallUtils do
814
830
  opts.merge(
815
831
  :format => :bash,
816
832
  :include_legacy_database_defaults => false,
833
+ :answers => {},
817
834
  )
818
835
  )
819
836
  end
@@ -829,6 +846,7 @@ describe ClassMixedWithDSLInstallUtils do
829
846
  opts.merge(
830
847
  :format => :hiera,
831
848
  :include_legacy_database_defaults => false,
849
+ :answers => { :meep_schema_version => '1.0' },
832
850
  )
833
851
  )
834
852
  end
@@ -844,12 +862,44 @@ describe ClassMixedWithDSLInstallUtils do
844
862
  )
845
863
  end
846
864
 
847
- it 'adds meep_schema_version' do
865
+ it 'sets meep_schema_version 1.0' do
848
866
  expect(subject.setup_beaker_answers_opts(host, options)).to eq(
849
867
  options.merge(
850
868
  :format => :hiera,
851
869
  :include_legacy_database_defaults => false,
852
- :meep_schema_version => '2.0',
870
+ :answers => {
871
+ :feature_flags => {
872
+ :pe_modules_next => true
873
+ },
874
+ :meep_schema_version => '1.0',
875
+ }
876
+ )
877
+ )
878
+ end
879
+ end
880
+
881
+ context 'with meep-classification' do
882
+ let(:options) do
883
+ opts.merge(
884
+ :answers => {
885
+ :feature_flags => {
886
+ :meep_classification => true
887
+ }
888
+ }
889
+ )
890
+ end
891
+
892
+ it 'adds meep_schema_version 2.0' do
893
+ expect(subject.setup_beaker_answers_opts(host, options)).to eq(
894
+ options.merge(
895
+ :format => :hiera,
896
+ :include_legacy_database_defaults => false,
897
+ :answers => {
898
+ :feature_flags => {
899
+ :meep_classification => true
900
+ },
901
+ :meep_schema_version => '2.0',
902
+ }
853
903
  )
854
904
  )
855
905
  end
@@ -866,6 +916,9 @@ describe ClassMixedWithDSLInstallUtils do
866
916
  opts.merge(
867
917
  :format => :hiera,
868
918
  :include_legacy_database_defaults => false,
919
+ :answers => {
920
+ :meep_schema_version => '1.0',
921
+ }
869
922
  )
870
923
  )
871
924
  end
@@ -878,6 +931,9 @@ describe ClassMixedWithDSLInstallUtils do
878
931
  opts.merge(
879
932
  :format => :hiera,
880
933
  :include_legacy_database_defaults => true,
934
+ :answers => {
935
+ :meep_schema_version => '1.0',
936
+ }
881
937
  )
882
938
  )
883
939
  end
@@ -2288,7 +2344,7 @@ describe ClassMixedWithDSLInstallUtils do
2288
2344
  end
2289
2345
 
2290
2346
  describe 'configure_puppet_agent_service' do
2291
- let(:pe_version) { '2017.1.0' }
2347
+ let(:pe_version) { '2018.1.0' }
2292
2348
  let(:master) { hosts[0] }
2293
2349
 
2294
2350
  before(:each) do
@@ -2300,17 +2356,17 @@ describe ClassMixedWithDSLInstallUtils do
2300
2356
  expect { subject.configure_puppet_agent_service }.to raise_error(ArgumentError, /wrong number/)
2301
2357
  end
2302
2358
 
2303
- context 'master prior to 2017.1.0' do
2359
+ context 'master prior to 2018.1.0' do
2304
2360
  let(:pe_version) { '2016.5.1' }
2305
2361
 
2306
2362
  it 'raises an exception about version' do
2307
2363
  expect { subject.configure_puppet_agent_service({}) }.to(
2308
- raise_error(StandardError, /Can only manage.*2017.1.0; tried.* 2016.5.1/)
2364
+ raise_error(StandardError, /Can only manage.*2018.1.0; tried.* 2016.5.1/)
2309
2365
  )
2310
2366
  end
2311
2367
  end
2312
2368
 
2313
- context '2017.1.0 master' do
2369
+ context '2018.1.0 master' do
2314
2370
  let(:pe_conf_path) { '/etc/puppetlabs/enterprise/conf.d/pe.conf' }
2315
2371
  let(:pe_conf) do
2316
2372
  <<-EOF
@@ -2324,18 +2380,13 @@ describe ClassMixedWithDSLInstallUtils do
2324
2380
  "node_roles": {
2325
2381
  "pe_role::monolithic::primary_master": ["#{master.name}"],
2326
2382
  }
2327
- "pe_infrastructure::agent::puppet_service_managed": true
2328
- "pe_infrastructure::agent::puppet_service_ensure": "stopped"
2329
- "pe_infrastructure::agent::puppet_service_enabled": false
2383
+ "puppet_enterprise::profile::agent::puppet_service_managed": true
2384
+ "puppet_enterprise::profile::agent::puppet_service_ensure": "stopped"
2385
+ "puppet_enterprise::profile::agent::puppet_service_enabled": false
2330
2386
  EOF
2331
2387
  end
2332
2388
 
2333
2389
  it "modifies the agent puppet service settings in pe.conf" do
2334
- # mock hitting the console
2335
- dispatcher = double('dispatcher').as_null_object
2336
- expect(subject).to receive(:get_console_dispatcher_for_beaker_pe)
2337
- .and_return(dispatcher)
2338
-
2339
2390
  assert_meep_conf_edit(pe_conf, gold_pe_conf, pe_conf_path) do
2340
2391
  subject.configure_puppet_agent_service(:ensure => 'stopped', :enabled => false)
2341
2392
  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.39.0
4
+ version: 1.40.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Puppetlabs
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-03-23 00:00:00.000000000 Z
11
+ date: 2018-04-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rspec