beaker-pe 1.8.2 → 1.9.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
- MzRjNmZhOThhNGRhMGViOTQ0OGIzZTcyZjMxNDg5NGI3MTNhNWI0MQ==
4
+ ZmFlZGQ3MDE2NWE4ZmIxNWU5MDE2ODA1MTU4ZTQ0ZDY5ZTBlNGY2Yg==
5
5
  data.tar.gz: !binary |-
6
- YTRjZTBlZGU0MjgzZTc2ODhhY2JlMWIxMjMwNjRkZmQzN2Q3MDczMQ==
6
+ ZDExNTM0OTE1NzA4ODA2ZWMzMWY1MWVkOWQyMTZlOGMwYjAwOTBhZQ==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- M2ExNTJjNTNjZWY0ZDc0MmQ1NTcwMjkxYzliNTBkN2VhZGIyNzBlMDRjMjZh
10
- OGM0OWVmMGJlMmI2ODZhZjg3N2U4OTE5ZmZlZjcyNmZiNDYwZDg3ZDcyMjJk
11
- MjU4YTg5OTZkMzQwNTdlNzZlZmQwMjczYzE4ODlkYTU3MjBhNjc=
9
+ ZTdiZWE2ZDliZWFlNDMwNDJiNWNhM2RjYzQ5MjUwZGU2ZGIyMTg0ZmRkZmQz
10
+ ZjBjYzcwYmE4YTcwOGQ4MmFlOTg3MDJmYjllOTIzMmFiOGU3MTQ0MmFjNTA0
11
+ NTIzZGVjZmNkNGQ3NzczNDJlYjZmNzliNzRjM2MwYjdiMzM2ODQ=
12
12
  data.tar.gz: !binary |-
13
- ZWUxNWVkZjk4N2ZkZmIzYjJmY2I0MGYwMzI4ZTJlNDMyYjg5ZGJlMTY3Zjcy
14
- NTBiYmY1N2ViMDRkOGMyNmRhODVlNDZkMDQwODZjMTU4OTQzMzc2ODNjZGZi
15
- MzdkYThkZjUxMTA1N2UxOTM1OTUwMGQwMGM0NGM5OWQ0ZmVlZDc=
13
+ ZmYzOGFkMjA1YTE3NjAzZTUwNDMwYWVlZTcyYWRmZTVjZDBiNmNiZTU5NjE2
14
+ ODUwYmU1YmQ1NjY4ZmUwZTQzN2UwMjc5ZGExYjkyNTgyNjJhMmU1MjNjODcy
15
+ ZmJmYTZmZmY3MTZlZmI0MDBhMGFmODBhMTg2MzFiOWMzMGQyODk=
data/HISTORY.md CHANGED
@@ -1,6 +1,7 @@
1
- # default - History
1
+ # worker - History
2
2
  ## Tags
3
- * [LATEST - 6 Jan, 2017 (93ef8841)](#LATEST)
3
+ * [LATEST - 7 Feb, 2017 (d5c96d6b)](#LATEST)
4
+ * [1.8.2 - 6 Jan, 2017 (625c17e3)](#1.8.2)
4
5
  * [1.8.1 - 30 Dec, 2016 (3cefad28)](#1.8.1)
5
6
  * [1.8.0 - 30 Dec, 2016 (5a37fef7)](#1.8.0)
6
7
  * [1.7.0 - 20 Dec, 2016 (99e6bbde)](#1.7.0)
@@ -29,7 +30,85 @@
29
30
  * [0.1.0 - 29 Feb, 2016 (4fc88d8c)](#0.1.0)
30
31
 
31
32
  ## Details
32
- ### <a name = "LATEST">LATEST - 6 Jan, 2017 (93ef8841)
33
+ ### <a name = "LATEST">LATEST - 7 Feb, 2017 (d5c96d6b)
34
+
35
+ * (GEM) update beaker-pe version to 1.9.0 (d5c96d6b)
36
+
37
+ * (PE-19169) Add pe modules next flag (#55) (3ff8a996)
38
+
39
+
40
+ ```
41
+ (PE-19169) Add pe modules next flag (#55)
42
+
43
+ * (PE-19169,PE-18516) Remove version specific upgrade hack
44
+
45
+ This had been added to allow upgrade testing in flanders with meep for
46
+ classification prior to our having completed an upgrade workflow in the
47
+ installer.
48
+
49
+ Now that meep is being worked on in the pe-modules-next package behind a
50
+ feature-flag, this gate is counter-productive, particularly for Flanders
51
+ upgrade testing because it masks the common case of upgrading without
52
+ specifying a pe.conf.
53
+
54
+ * (PE-19169) Register flag for pe-modules-next if present in ENV
55
+
56
+ Major PE modules development work is being done in a separate
57
+ pe-modules-next package. The installer shim decides which pe-modules
58
+ package to install based on a pe.conf flag. This patch allows Jenkins CI
59
+ to trigger this by picking up ENV['PE_MODULES_NEXT'] and ensure that the
60
+ flag is set in the opts[:answers] which will then be transferred to
61
+ pe.conf by beaker-answers, and then picked up by the installer shim
62
+ during installation.
63
+
64
+ * (PE-19169) Ensure beaker-answers generates meep 2.0 schema
65
+
66
+ ...if we are installing with the pe_modules_next flag.
67
+
68
+ The pe-modules-next is meep classification at the moment and needs a 2.0
69
+ pe.conf generated.
70
+
71
+ * (PE-19169) Extract a FeatureFlags class
72
+
73
+ to make it easier to test. Flags can be set in the :answers Hash or
74
+ picked up from environment variables. In the later case, we need to be
75
+ able to preserver them in the :answers hash, if not already present, so
76
+ that BeakerAnswers ensures that they are set in the generated pe.conf
77
+ file.
78
+ ```
79
+ * Merge pull request #54 from branan/bkr-937-aix-7.2 (4e381151)
80
+
81
+
82
+ ```
83
+ Merge pull request #54 from branan/bkr-937-aix-7.2
84
+
85
+ (BKR-937) Add support for installing AIX 7 agent on 7.2
86
+ ```
87
+ * (maint) login_with_puppet_access_on should respect --lifetime flag (with spec tests) (#52) (c17a8daf)
88
+
89
+
90
+ ```
91
+ (maint) login_with_puppet_access_on should respect --lifetime flag (with spec tests) (#52)
92
+
93
+ * (maint) fix puppet access helper to respect lifetime argument
94
+
95
+ * (maint) Add spec tests for login_with_puppet_access_on
96
+ ```
97
+ * (BKR-937) Add support for installing AIX 7 agent on 7.2 (9aada073)
98
+
99
+
100
+ ```
101
+ (BKR-937) Add support for installing AIX 7 agent on 7.2
102
+
103
+ To avoid unnecessarily expanding our build times, our initial support
104
+ for AIX 7.2 is through the existing 7.1 package. This will be replaced
105
+ with a single unified AIX build in the Agent 2.0 timeframe, but for now
106
+ we need to add a little bit of special-case logic to handle 7.2 with
107
+ existing packages.
108
+ ```
109
+ ### <a name = "1.8.2">1.8.2 - 6 Jan, 2017 (625c17e3)
110
+
111
+ * (HISTORY) update beaker-pe history for gem release 1.8.2 (625c17e3)
33
112
 
34
113
  * (GEM) update beaker-pe version to 1.8.2 (93ef8841)
35
114
 
@@ -0,0 +1,114 @@
1
+ module Beaker::DSL::InstallUtils
2
+ # This helper class encapsulates querying feature flag settings from
3
+ # options[:answers] which can be used to drive Beaker's install behavior
4
+ # around new or experimental features, typically in the PE Modules.
5
+ #
6
+ # Also handles initializing feature flag settings from environment variables
7
+ # for CI. In this way, flags can be pulled in without needing to munge
8
+ # Beaker's config file which is often handled inside of a script in Jenkins.
9
+ #
10
+ # Flags are expected to be found in a +feature_flags+ hash in the
11
+ # options[:answers] under the key :feature_flags. Beaker::OptionHash should
12
+ # ensure that all keys end up as symbols. If you are programatically
13
+ # constructing the answers, you must take care to use merge() to add
14
+ # elements.
15
+ #
16
+ # @example The use of the pe-modules-next package is handled by:
17
+ # :answers => {
18
+ # :feature_flags => {
19
+ # :pe_modules_next => true
20
+ # }
21
+ # }
22
+ #
23
+ # All flag keys are expected to be downcased with hyphens.
24
+ #
25
+ # Environment variables may be uppercased.
26
+ class FeatureFlags
27
+ FLAGS = %w{
28
+ pe_modules_next
29
+ }.freeze
30
+
31
+ attr_reader :options
32
+
33
+ def initialize(options)
34
+ @options = options
35
+ end
36
+
37
+ # Returns the boolean state of the flag as found in options[:answers],
38
+ # or if not found in the answers, then it checks for an environment variable.
39
+ #
40
+ # @param String flag key
41
+ # @return [Boolean,nil] boolean true or false unless not found at all, then nil.
42
+ def flag?(flag)
43
+ key = canonical_key(flag)
44
+ state = flags[key] if flags?
45
+ state = environment_flag?(key) if state.nil?
46
+
47
+ case state
48
+ when nil then nil
49
+ else state.to_s == 'true'
50
+ end
51
+ end
52
+
53
+ # Updates options[:answers][:feature_flags] with any environment variables
54
+ # found based on FLAGS, but if and only if they are not already present.
55
+ #
56
+ # (existing :answers take precedence)
57
+ def register_flags!
58
+ answers_with_registered_flags = answers
59
+ answers_with_registered_flags[:feature_flags] ||= StringifyHash.new
60
+ new_flags = answers_with_registered_flags[:feature_flags]
61
+
62
+ FLAGS.each do |flag|
63
+ key = canonical_key(flag)
64
+ value = flag?(key)
65
+ if !new_flags.include?(key) && !value.nil?
66
+ new_flags[key] = value
67
+ end
68
+ end
69
+
70
+ options.merge!(
71
+ :answers => answers_with_registered_flags
72
+ ) if !new_flags.empty?
73
+
74
+ options
75
+ end
76
+
77
+ private
78
+
79
+ # Does the +feature_flags+ hash exist?
80
+ def flags?
81
+ answers? && !answers[:feature_flags].nil?
82
+ end
83
+
84
+ def flags
85
+ answers[:feature_flags] || StringifyHash.new
86
+ end
87
+
88
+ # Does the +answers+ hash exist?
89
+ def answers?
90
+ !options[:answers].nil?
91
+ end
92
+
93
+ def answers
94
+ options[:answers] || StringifyHash.new
95
+ end
96
+
97
+ def canonical_key(key)
98
+ key.to_s.downcase.to_sym
99
+ end
100
+
101
+ def environmental_keys(key)
102
+ [key.to_s.upcase, key.to_s.downcase]
103
+ end
104
+
105
+ def environment_flag?(flag)
106
+ value = nil
107
+ environmental_keys(flag).each do |f|
108
+ value = ENV[f] if ENV.include?(f)
109
+ break if !value.nil?
110
+ end
111
+ value
112
+ end
113
+ end
114
+ end
@@ -1,6 +1,7 @@
1
1
  [ 'aio_defaults', 'pe_defaults', 'puppet_utils', 'windows_utils' ].each do |lib|
2
2
  require "beaker/dsl/install_utils/#{lib}"
3
3
  end
4
+ require 'beaker-pe/install/feature_flags'
4
5
  require "beaker-answers"
5
6
  require "timeout"
6
7
  require "json"
@@ -119,13 +120,9 @@ module Beaker
119
120
  pe_cmd += " -y"
120
121
  end
121
122
 
122
- # This is a temporary workaround for PE-18516, because MEEP does not yet create a 2.0
123
- # pe.conf when recovering configuration in Flanders. This will be fixed in PE-18170.
124
- if opts[:type] == :upgrade && !version_is_less(host['pe_upgrade_ver'], '2017.1.0')
125
- "#{pe_cmd} #{host['pe_installer_conf_setting']}"
126
123
  # If there are no answer overrides, and we are doing an upgrade from 2016.2.0,
127
124
  # we can assume there will be a valid pe.conf in /etc that we can re-use.
128
- elsif opts[:answers].nil? && opts[:custom_answers].nil? && opts[:type] == :upgrade && !version_is_less(opts[:HOSTS][host.name][:pe_ver], '2016.2.0')
125
+ if opts[:answers].nil? && opts[:custom_answers].nil? && opts[:type] == :upgrade && !version_is_less(opts[:HOSTS][host.name][:pe_ver], '2016.2.0')
129
126
  "#{pe_cmd}"
130
127
  else
131
128
  "#{pe_cmd} #{host['pe_installer_conf_setting']}"
@@ -289,7 +286,14 @@ module Beaker
289
286
  # @param [Host] host The host to install pacakges for
290
287
  # @api private
291
288
  def deploy_frictionless_to_master(host)
292
- klass = host['platform'].gsub(/-/, '_').gsub(/\./,'')
289
+ platform = host['platform']
290
+
291
+ # We don't have a separate AIX 7.2 build, so it is
292
+ # classified as 7.1 for pe_repo purposes
293
+ if platform == "aix-7.2-power"
294
+ platform = "aix-7.1-power"
295
+ end
296
+ klass = platform.gsub(/-/, '_').gsub(/\./,'')
293
297
  if host['platform'] =~ /windows/
294
298
  if host['template'] =~ /i386/
295
299
  klass = "pe_repo::platform::windows_i386"
@@ -442,6 +446,7 @@ module Beaker
442
446
  setup_defaults_and_config_helper_on(host, master, acceptable_codes)
443
447
  else
444
448
  prepare_host_installer_options(host)
449
+ register_feature_flags!(opts)
445
450
  generate_installer_conf_file_for(host, hosts, opts)
446
451
  on host, installer_cmd(host, opts)
447
452
  configure_type_defaults_on(host)
@@ -611,6 +616,19 @@ module Beaker
611
616
  !version_is_less(version, MEEP_CUTOVER_VERSION)
612
617
  end
613
618
 
619
+ # Tests if a feature flag has been set in the answers hash provided to beaker
620
+ # options. Assumes a 'feature_flags' hash is present in the answers and looks for
621
+ # +flag+ within it.
622
+ #
623
+ # @param flag String flag to lookup
624
+ # @param opts Hash options hash to inspect
625
+ # @return true if +flag+ is true or 'true' in the feature_flags hash,
626
+ # false otherwise. However, returns nil if there is no +flag+ in the
627
+ # answers hash at all
628
+ def feature_flag?(flag, opts)
629
+ Beaker::DSL::InstallUtils::FeatureFlags.new(opts).flag?(flag)
630
+ end
631
+
614
632
  # Check if windows host is able to frictionlessly install puppet
615
633
  # @param [Beaker::Host] host that we are checking if it is possible to install frictionlessly to
616
634
  # @return [Boolean] true if frictionless is supported and not affected by known bugs
@@ -677,7 +695,39 @@ module Beaker
677
695
  beaker_answers_opts[:include_legacy_database_defaults] =
678
696
  opts[:type] == :upgrade && !use_meep?(host['previous_pe_ver'])
679
697
 
680
- opts.merge(beaker_answers_opts)
698
+ modified_opts = opts.merge(beaker_answers_opts)
699
+
700
+ if feature_flag?('pe_modules_next', opts) && !modified_opts.include?(:meep_schema_version)
701
+ modified_opts[:meep_schema_version] = '2.0'
702
+ end
703
+
704
+ modified_opts
705
+ end
706
+
707
+ # The pe-modules-next package is being used for isolating large scale
708
+ # feature development of PE module code. The feature flag is a pe.conf
709
+ # setting 'feature_flags::pe_modules_next', which if set true will
710
+ # cause the installer shim to install the pe-modules-next package
711
+ # instead of pe-modules.
712
+ #
713
+ # This answer can be explicitly added to Beaker's cfg file by adding it
714
+ # to the :answers section.
715
+ #
716
+ # But it can also be picked up transparently from CI via the
717
+ # PE_MODULES_NEXT environment variable. If this is set 'true', then
718
+ # the opts[:answers] will be set with feature_flags::pe_modules_next.
719
+ #
720
+ # Answers set in Beaker's config file will take precedence over the
721
+ # environment variable.
722
+ #
723
+ # NOTE: This has implications for upgrades, because upgrade testing
724
+ # will need the flag, but upgrades from different pe.conf schema (or no
725
+ # pe.conf) will need to generate a pe.conf, and that workflow is likely
726
+ # to happen in the installer shim. If we simply supply a good pe.conf
727
+ # via beaker-answers, then we have bypassed the pe.conf generation
728
+ # aspect of the upgrade workflow. (See PE-19438)
729
+ def register_feature_flags!(opts)
730
+ Beaker::DSL::InstallUtils::FeatureFlags.new(opts).register_flags!
681
731
  end
682
732
 
683
733
  # Generates a Beaker Answers object for the passed *host* and creates
@@ -75,7 +75,9 @@ module Beaker
75
75
 
76
76
  user = credentialed_dispatcher.credentials.login
77
77
  password = credentialed_dispatcher.credentials.password
78
- puppet_access_on(host, 'login', {:stdin => "#{user}\n#{password}\n"})
78
+ args = ['login']
79
+ args.push "--lifetime #{lifetime}" if lifetime
80
+ puppet_access_on(host, *args, {:stdin => "#{user}\n#{password}\n"})
79
81
  else
80
82
 
81
83
  # this is a hack
@@ -3,7 +3,7 @@ module Beaker
3
3
  module PE
4
4
 
5
5
  module Version
6
- STRING = '1.8.2'
6
+ STRING = '1.9.0'
7
7
  end
8
8
 
9
9
  end
@@ -0,0 +1,174 @@
1
+ require 'spec_helper'
2
+
3
+ describe Beaker::DSL::InstallUtils::FeatureFlags do
4
+ let(:options) do
5
+ opts= Beaker::Options::Presets.new
6
+ opts.presets.merge(opts.env_vars)
7
+ end
8
+ let(:flags) { Beaker::DSL::InstallUtils::FeatureFlags.new(options) }
9
+ let(:answers) do
10
+ {
11
+ 'answers' => {
12
+ 'feature_flags' => feature_flags
13
+ }
14
+ }
15
+ end
16
+ let(:feature_flags) { {} }
17
+ let(:feature_flags) do
18
+ {
19
+ 'pe_modules_next' => flag
20
+ }
21
+ end
22
+ let(:environment_flag_key) { "PE_MODULES_NEXT" }
23
+ let(:environment_flag_value) {}
24
+
25
+ context 'neither answers nor env' do
26
+ it { expect(flags.send(:answers)).to eq(StringifyHash.new) }
27
+ it { expect(flags.send(:answers?)).to eq(false) }
28
+ it { expect(flags.send(:flags)).to eq(StringifyHash.new) }
29
+ it { expect(flags.send(:flags?)).to eq(false) }
30
+ it { expect(flags.flag?('foo')).to be_nil }
31
+ it { expect(flags.flag?(:pe_modules_next)).to be_nil }
32
+ it { expect(flags.flag?('pe_modules_next')).to be_nil }
33
+ end
34
+
35
+ context 'answers' do
36
+ let(:flag) {}
37
+
38
+ before(:each) do
39
+ options.merge!(answers)
40
+ end
41
+
42
+ it { expect(flags.flag?('pe_modules_next')).to be_nil }
43
+
44
+ context 'with flag' do
45
+ context 'true' do
46
+ let(:flag) { true }
47
+ it { expect(flags.flag?('pe_modules_next')).to eq(true) }
48
+ it { expect(flags.flag?(:pe_modules_next)).to eq(true) }
49
+ end
50
+
51
+ context 'true as a string' do
52
+ let(:flag) { 'true' }
53
+ it { expect(flags.flag?('pe_modules_next')).to eq(true) }
54
+ it { expect(flags.flag?(:pe_modules_next)).to eq(true) }
55
+ end
56
+
57
+ context 'false' do
58
+ let(:flag) { false }
59
+ it { expect(flags.flag?('pe_modules_next')).to eq(false) }
60
+ it { expect(flags.flag?(:pe_modules_next)).to eq(false) }
61
+ end
62
+
63
+ context 'false as a string' do
64
+ let(:flag) { 'false' }
65
+ it { expect(flags.flag?('pe_modules_next')).to eq(false) }
66
+ it { expect(flags.flag?(:pe_modules_next)).to eq(false) }
67
+ end
68
+ end
69
+ end
70
+
71
+ context 'env' do
72
+ before(:each) do
73
+ allow(ENV).to receive(:[]).and_call_original
74
+ allow(ENV).to receive(:include?).and_call_original
75
+ expect(ENV).to receive(:[]).with(environment_flag_key).and_return(environment_flag_value)
76
+ expect(ENV).to receive(:include?).with(environment_flag_key).and_return(true)
77
+ end
78
+
79
+ it { expect(flags.flag?(:pe_modules_next)).to eq(nil) }
80
+
81
+ context 'with flag' do
82
+ context 'true' do
83
+ let(:environment_flag_value) { 'true' }
84
+ it { expect(flags.flag?('pe_modules_next')).to eq(true) }
85
+ it { expect(flags.flag?(:pe_modules_next)).to eq(true) }
86
+ end
87
+
88
+ context 'false' do
89
+ let(:environment_flag_value) { 'false' }
90
+ it { expect(flags.flag?('pe_modules_next')).to eq(false) }
91
+ it { expect(flags.flag?(:pe_modules_next)).to eq(false) }
92
+ end
93
+ end
94
+ end
95
+
96
+ context 'answers and env' do
97
+ before(:each) do
98
+ options.merge!(answers)
99
+ allow(ENV).to receive(:include?).and_call_original
100
+ expect(ENV).to_not receive(:include?).with('pe_modules_next')
101
+ expect(ENV).to_not receive(:include?).with('PE_MODULES_NEXT')
102
+ end
103
+
104
+ context 'answers true and env false' do
105
+ let(:flag) { 'true' }
106
+
107
+ it { expect(flags.flag?(:pe_modules_next)).to eq(true) }
108
+ end
109
+
110
+ context 'answers false and env true' do
111
+ let(:flag) { 'false' }
112
+
113
+ it { expect(flags.flag?(:pe_modules_next)).to eq(false) }
114
+ end
115
+ end
116
+
117
+ context 'registering flags' do
118
+ it do
119
+ expect(flags.register_flags!).to eq(options)
120
+ expect(options[:answers]).to be_nil
121
+ end
122
+
123
+ context 'with env variables' do
124
+ before(:each) do
125
+ allow(ENV).to receive(:[]).and_call_original
126
+ allow(ENV).to receive(:include?).and_call_original
127
+ expect(ENV).to receive(:include?).with('pe_modules_next').and_return(true)
128
+ end
129
+
130
+ it 'picks up a true flag from environment' do
131
+ expect(ENV).to receive(:[]).with('pe_modules_next').and_return('true')
132
+
133
+ flags.register_flags!
134
+ expect(options[:answers]).to match(
135
+ :feature_flags => {
136
+ :pe_modules_next => true
137
+ }
138
+ )
139
+ end
140
+
141
+ it 'picks up a false flag from environment' do
142
+ expect(ENV).to receive(:[]).with('pe_modules_next').and_return('false')
143
+
144
+ flags.register_flags!
145
+ expect(options[:answers]).to match(
146
+ :feature_flags => {
147
+ :pe_modules_next => false
148
+ }
149
+ )
150
+ end
151
+ end
152
+
153
+ context 'with answers and env variables' do
154
+ let(:flag) { false }
155
+
156
+ before(:each) do
157
+ answers['answers'][:some_other_answer] = 'value'
158
+ options.merge!(answers)
159
+ allow(ENV).to receive(:include?).and_call_original
160
+ expect(ENV).to_not receive(:include?).with('pe_modules_next')
161
+ end
162
+
163
+ it do
164
+ flags.register_flags!
165
+ expect(options[:answers]).to match(
166
+ :some_other_answer => 'value',
167
+ :feature_flags => {
168
+ :pe_modules_next => false
169
+ },
170
+ )
171
+ end
172
+ end
173
+ end
174
+ end
@@ -416,6 +416,104 @@ describe ClassMixedWithDSLInstallUtils do
416
416
  end
417
417
  end
418
418
 
419
+ describe 'register_feature_flags!' do
420
+ it 'does nothing if no flag is set' do
421
+ expect(subject.register_feature_flags!(opts)).to eq(opts)
422
+ expect(opts[:answers]).to be_nil
423
+ end
424
+
425
+ context 'with flag set' do
426
+ before(:each) do
427
+ ENV['PE_MODULES_NEXT'] = 'true'
428
+ end
429
+
430
+ after(:each) do
431
+ ENV.delete('PE_MODULES_NEXT')
432
+ end
433
+
434
+ it 'updates answers' do
435
+ expect(subject.register_feature_flags!(opts)).to match(opts.merge({
436
+ :answers => {
437
+ :feature_flags => {
438
+ :pe_modules_next => true
439
+ }
440
+ }
441
+ }))
442
+ end
443
+
444
+ context 'and answer explicitly set' do
445
+ let(:answers) do
446
+ {
447
+ :answers => {
448
+ 'feature_flags' => {
449
+ 'pe_modules_next' => false
450
+ }
451
+ }
452
+ }
453
+ end
454
+
455
+ before(:each) do
456
+ opts.merge!(answers)
457
+ end
458
+
459
+ it 'keeps explicit setting' do
460
+ expect(subject.register_feature_flags!(opts)).to match(opts.merge(answers))
461
+ end
462
+ end
463
+ end
464
+ end
465
+
466
+ describe 'feature_flag?' do
467
+
468
+ context 'without :answers' do
469
+ it 'is nil for pe_modules_next' do
470
+ expect(subject.feature_flag?('pe_modules_next', opts)).to eq(nil)
471
+ expect(subject.feature_flag?(:pe_modules_next, opts)).to eq(nil)
472
+ end
473
+ end
474
+
475
+ context 'with :answers but no flag' do
476
+ before(:each) do
477
+ opts[:answers] = {}
478
+ end
479
+
480
+ it 'is nil for pe_modules_next' do
481
+ expect(subject.feature_flag?('pe_modules_next', opts)).to eq(nil)
482
+ expect(subject.feature_flag?(:pe_modules_next, opts)).to eq(nil)
483
+ end
484
+ end
485
+
486
+ context 'with answers set' do
487
+ let(:options) do
488
+ opts.merge(
489
+ :answers => {
490
+ 'feature_flags' => {
491
+ 'pe_modules_next' => flag
492
+ }
493
+ }
494
+ )
495
+ end
496
+
497
+ context 'false' do
498
+ let(:flag) { false }
499
+ it { expect(subject.feature_flag?('pe_modules_next', options)).to eq(false) }
500
+ it { expect(subject.feature_flag?(:pe_modules_next, options)).to eq(false) }
501
+ end
502
+
503
+ context 'true' do
504
+ let(:flag) { true }
505
+ it { expect(subject.feature_flag?('pe_modules_next', options)).to eq(true) }
506
+ it { expect(subject.feature_flag?(:pe_modules_next, options)).to eq(true) }
507
+
508
+ context 'as string' do
509
+ let(:flag) { 'true' }
510
+ it { expect(subject.feature_flag?('pe_modules_next', options)).to eq(true) }
511
+ it { expect(subject.feature_flag?(:pe_modules_next, options)).to eq(true) }
512
+ end
513
+ end
514
+ end
515
+ end
516
+
419
517
  describe 'setup_beaker_answers_opts' do
420
518
  let(:opts) { {} }
421
519
  let(:host) { hosts.first }
@@ -445,6 +543,28 @@ describe ClassMixedWithDSLInstallUtils do
445
543
  )
446
544
  end
447
545
 
546
+ context 'with pe-modules-next' do
547
+ let(:options) do
548
+ opts.merge(
549
+ :answers => {
550
+ :feature_flags => {
551
+ :pe_modules_next => true
552
+ }
553
+ }
554
+ )
555
+ end
556
+
557
+ it 'adds meep_schema_version' do
558
+ expect(subject.setup_beaker_answers_opts(host, options)).to eq(
559
+ options.merge(
560
+ :format => :hiera,
561
+ :include_legacy_database_defaults => false,
562
+ :meep_schema_version => '2.0',
563
+ )
564
+ )
565
+ end
566
+ end
567
+
448
568
  context 'when upgrading' do
449
569
  let(:opts) { { :type => :upgrade } }
450
570
 
@@ -1,5 +1,6 @@
1
1
  require 'spec_helper'
2
2
  require 'beaker'
3
+ require 'scooter'
3
4
 
4
5
  class MixedWithExecutableHelper
5
6
  include Beaker::DSL::PEClientTools::ExecutableHelper
@@ -9,7 +10,7 @@ describe MixedWithExecutableHelper do
9
10
 
10
11
  let(:method_name) { "puppet_#{tool}_on"}
11
12
 
12
- shared_examples 'pe-client-tool'do
13
+ shared_examples 'pe-client-tool' do
13
14
 
14
15
  it 'has a method to execute the tool' do
15
16
  expect(subject.respond_to?(method_name)).not_to be(false)
@@ -55,4 +56,28 @@ describe MixedWithExecutableHelper do
55
56
  it 'has a method to login with puppet access' do
56
57
  expect(subject.respond_to?('login_with_puppet_access_on')).not_to be(false)
57
58
  end
58
- end
59
+
60
+ context 'puppet access login with lifetime parameter' do
61
+ let(:logger) {Beaker::Logger.new}
62
+ let(:test_host) {Beaker::Host.create('my_super_host',
63
+ {:roles => ['master', 'agent'],
64
+ :platform => 'linux',
65
+ :type => 'pe'},
66
+ make_opts)}
67
+ let(:username) {'T'}
68
+ let(:password) {'Swift'}
69
+ let(:credentials) {{:login => username, :password => password}}
70
+ let(:test_dispatcher) {Scooter::HttpDispatchers::ConsoleDispatcher.new('my_super_host', credentials)}
71
+
72
+ before do
73
+ allow(logger).to receive(:debug) { true }
74
+ expect(test_dispatcher).to be_kind_of(Scooter::HttpDispatchers::ConsoleDispatcher)
75
+ expect(test_host).to be_kind_of(Beaker::Host)
76
+ expect(test_host).to receive(:exec)
77
+ end
78
+
79
+ it 'accepts correct value' do
80
+ expect{subject.login_with_puppet_access_on(test_host, test_dispatcher, {:lifetime => '5d'})}.not_to raise_error
81
+ end
82
+ end
83
+ 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.8.2
4
+ version: 1.9.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-01-06 00:00:00.000000000 Z
11
+ date: 2017-02-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rspec
@@ -190,6 +190,7 @@ files:
190
190
  - bin/beaker-template
191
191
  - docs/how_to/install_puppet_enterprise.md
192
192
  - lib/beaker-pe.rb
193
+ - lib/beaker-pe/install/feature_flags.rb
193
194
  - lib/beaker-pe/install/pe_utils.rb
194
195
  - lib/beaker-pe/options/pe_version_scraper.rb
195
196
  - lib/beaker-pe/pe-client-tools/config_file_helper.rb
@@ -197,6 +198,7 @@ files:
197
198
  - lib/beaker-pe/pe-client-tools/install_helper.rb
198
199
  - lib/beaker-pe/version.rb
199
200
  - spec/beaker-pe/helpers_spec.rb
201
+ - spec/beaker-pe/install/feature_flags_spec.rb
200
202
  - spec/beaker-pe/install/pe_utils_spec.rb
201
203
  - spec/beaker-pe/options/pe_version_scaper_spec.rb
202
204
  - spec/beaker-pe/pe-client-tools/config_file_helper_spec.rb