beaker-answers 0.16.0 → 0.17.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
- YzJjYTUxYjY2MDk4NTc3YWQyODRiZTk1OWIzODg1OTY0MzY0ZjdhNw==
4
+ NzA5OTEzMmU0MDg4YWJmZGE3M2I2MjUwYmUxNjg2YmVlYjVhNjI3Nw==
5
5
  data.tar.gz: !binary |-
6
- YTk3N2VkNjYxYWQxNGI2NGI0OTM3MTQ4MTM4YzNjNWI4ZGNiZTUzNw==
6
+ ZDBjZDcxNDFmZTQ5MWM3YjFhZjNkNWM5M2E4MTQwM2Y2Zjk5ZmQ2Yw==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- MjkwZWVhMTk4YmNiYTBmNDQyNDQ2MThhODhmYjlmZmVkMmNmNWM4NGQ1Yzg5
10
- OGIwMzdhNDJkZDc2OGUwYjNjYWQ1NGNlNzRiMjk5OGE1YzQ3NzljNDVhNzg0
11
- ZGY0MmFkNDQ4YTQ0NmZhNTZiZTQ4OTc5OTQxYzY1OWVhMWZiYmQ=
9
+ OWJlNzVmOGI0MDkwYWUxNDAwNTY4OTRmYzU1MjcwYTMyMjlhZDRhYjc0Nzg0
10
+ MjEyNDU0M2ZiMzdlZDcyNTQzZjk2NTk4MGZmNWU0NzQ4NWNhYjM3NjI4YmU3
11
+ ODY1M2MzMTI1MGY1ZjY1MGE3NzUwNGQzZDJlMjViZGU5ZWEyNmE=
12
12
  data.tar.gz: !binary |-
13
- MTA3NjcwYjQwYmM5ZmVhOGRjYmRhODAwYTI0NjRiMjRhNmMzZTJjMTZlZGU4
14
- ZjkwODYxMjlkZmU3NjU2YTc5MjdiMmFhNDAxYjczMWI5YTRjNDY4YTgzYTA1
15
- MzcwOWQ3ZmNmNjM0MGVkZTA3N2M3YjFhOTVkZTY5OTM2NGQxZTg=
13
+ MDE1MDcwZTQ5ODEwMWUxMWQ3ODc3N2MwODk5ZjkzZjQyY2Q1MzdhY2M5YWMy
14
+ MjkyNWI5ZGNiOTlkNjQ1MDZmY2Q1NjUwYTNjN2E4NjdmMDA0YmM4NWNjZjdl
15
+ NWYxMGNjZTExNGQ5ZTFiNzgzODc0NDY1YWVmN2E4YjJiNDYzOWE=
data/HISTORY.md CHANGED
@@ -1,6 +1,7 @@
1
1
  # worker - History
2
2
  ## Tags
3
- * [LATEST - 7 Apr, 2017 (297e2195)](#LATEST)
3
+ * [LATEST - 24 Apr, 2017 (41959c8b)](#LATEST)
4
+ * [0.16.0 - 7 Apr, 2017 (98d08e5c)](#0.16.0)
4
5
  * [0.15.0 - 22 Mar, 2017 (9df229c3)](#0.15.0)
5
6
  * [0.14.0 - 19 Jan, 2017 (290c75b2)](#0.14.0)
6
7
  * [0.13.0 - 9 Nov, 2016 (729ddd0b)](#0.13.0)
@@ -27,7 +28,46 @@
27
28
  * [0.1.0 - 26 Aug, 2015 (ef47972d)](#0.1.0)
28
29
 
29
30
  ## Details
30
- ### <a name = "LATEST">LATEST - 7 Apr, 2017 (297e2195)
31
+ ### <a name = "LATEST">LATEST - 24 Apr, 2017 (41959c8b)
32
+
33
+ * (GEM) update beaker-answers version to 0.17.0 (41959c8b)
34
+
35
+ * (maint) Do not flatten answers (598f8ce5)
36
+
37
+
38
+ ```
39
+ (maint) Do not flatten answers
40
+
41
+ When generating meep 2.0 answers.
42
+
43
+ Changes in version20162.rb took an answers structure like:
44
+
45
+ :answers
46
+ puppet_enterprise:
47
+ profile:
48
+ "master::foo": bar
49
+
50
+ and produce a pe.conf with
51
+
52
+ "puppet_enterprise::profile::master::foo": "bar"
53
+
54
+ This might be a convenience for some kinds of parameter listing, but
55
+ breaks your ability to submit actually structured data such as:
56
+
57
+ :answers
58
+ feature_flags:
59
+ pe_modules_next: true
60
+
61
+ Where feature_flags is supposed to be a hash, and not a parameter.
62
+
63
+ This pr takes the approach of just fixing new behavior in Glisan, when
64
+ using Meep 2.0 format (pe-modules-next), but it might be better to
65
+ change the behavior altogether, although this is a breaking change for
66
+ anyone relying on the previous 'helpful' collapsing of answer elements.
67
+ ```
68
+ ### <a name = "0.16.0">0.16.0 - 7 Apr, 2017 (98d08e5c)
69
+
70
+ * (HISTORY) update beaker-answers history for gem release 0.16.0 (98d08e5c)
31
71
 
32
72
  * (GEM) update beaker-answers version to 0.16.0 (297e2195)
33
73
 
@@ -1,5 +1,5 @@
1
1
  module BeakerAnswers
2
2
  module Version
3
- STRING = '0.16.0'
3
+ STRING = '0.17.0'
4
4
  end
5
5
  end
@@ -10,6 +10,29 @@ module BeakerAnswers
10
10
  /\A2017\.2/
11
11
  end
12
12
 
13
+ def generate_hiera_config
14
+ hiera_hash = super
15
+
16
+ if hiera_hash.include?('meep_schema_version') && @options[:answers]
17
+ # The meep 2.0 schema format includes structured data, which you could
18
+ # conceivably overwrite in your :answers and not want flattened.
19
+ # We're removing the flattened keys added in the Version20162 and
20
+ # reading them here rather than breaking compatibilty with existing
21
+ # Version20162 behavior. We're sorry.
22
+ hiera_hash.reject! do |k,v|
23
+ flatten_keys_to_joined_string(@options[:answers]).include?(k)
24
+ end
25
+ stringified_answers = @options[:answers].inject({}) do |hash,entry|
26
+ key = entry[0]
27
+ value = entry[1]
28
+ hash[key.to_s] = value
29
+ hash
30
+ end
31
+ hiera_hash.merge!(stringified_answers)
32
+ end
33
+ hiera_hash
34
+ end
35
+
13
36
  # This is used to generate the profile host parameters, but now passes the
14
37
  # options[:meep_schema_version] to determine which form of pe.conf is to be
15
38
  # generated.
@@ -131,15 +131,14 @@ RSpec.shared_examples 'pe.conf' do
131
131
  end
132
132
  end
133
133
 
134
+ end
135
+
136
+ RSpec.shared_examples "overriding answers" do
134
137
  context 'when overriding answers' do
135
138
  let( :options ) do
136
139
  {
137
140
  :format => 'hiera',
138
- :answers => {
139
- 'puppet_enterprise' => { 'certificate_authority_host' => 'enterpriseca.vm' },
140
- 'puppet_enterprise::console_host' => 'enterpriseconsole.vm',
141
- 'console_admin_password' => 'testing123',
142
- }
141
+ :answers => answers_with_strings,
143
142
  }
144
143
  end
145
144
 
@@ -152,13 +151,7 @@ RSpec.shared_examples 'pe.conf' do
152
151
  let( :options ) do
153
152
  {
154
153
  :format => 'hiera',
155
- :answers => {
156
- :puppet_enterprise => {
157
- :certificate_authority_host => 'enterpriseca.vm',
158
- :console_host => 'enterpriseconsole.vm',
159
- },
160
- :console_admin_password => 'testing123',
161
- }
154
+ :answers => answers_with_symbols,
162
155
  }
163
156
  end
164
157
 
@@ -169,6 +162,39 @@ RSpec.shared_examples 'pe.conf' do
169
162
  end
170
163
 
171
164
  RSpec.shared_examples "valid MEEP 2.0 pe.conf" do
165
+ let(:answers_with_symbols) do
166
+ {
167
+ :"puppet_enterprise::certificate_authority_host" => 'enterpriseca.vm',
168
+ :"puppet_enterprise::console_host" => 'enterpriseconsole.vm',
169
+ :console_admin_password => 'testing123',
170
+ :feature_flags => {
171
+ 'pe_modules_next' => true,
172
+ },
173
+ }
174
+ end
175
+ let(:answers_with_strings) do
176
+ {
177
+ 'puppet_enterprise::certificate_authority_host' => 'enterpriseca.vm',
178
+ 'puppet_enterprise::console_host' => 'enterpriseconsole.vm',
179
+ 'console_admin_password' => 'testing123',
180
+ 'feature_flags' => {
181
+ 'pe_modules_next' => true,
182
+ },
183
+ }
184
+ end
185
+ let( :overridding_parameters ) do
186
+ {
187
+ 'puppet_enterprise::certificate_authority_host' => 'enterpriseca.vm',
188
+ 'puppet_enterprise::console_host' => 'enterpriseconsole.vm',
189
+ 'console_admin_password' => 'testing123',
190
+ 'feature_flags' => {
191
+ 'pe_modules_next' => true,
192
+ }
193
+ }
194
+ end
195
+
196
+ include_examples "overriding answers"
197
+
172
198
  it 'generates valid MEEP 2.0 json if #answer_hiera is called' do
173
199
  expect(answer_hiera).not_to be_empty
174
200
  expect { JSON.load(answer_hiera) }.not_to raise_error
@@ -196,6 +222,25 @@ RSpec.shared_examples "valid MEEP 2.0 pe.conf" do
196
222
  end
197
223
 
198
224
  RSpec.shared_examples "valid MEEP 1.0 pe.conf" do
225
+ let(:answers_with_symbols) do
226
+ {
227
+ :puppet_enterprise => {
228
+ :certificate_authority_host => 'enterpriseca.vm',
229
+ :console_host => 'enterpriseconsole.vm',
230
+ },
231
+ :console_admin_password => 'testing123',
232
+ }
233
+ end
234
+ let(:answers_with_strings) do
235
+ {
236
+ 'puppet_enterprise' => { 'certificate_authority_host' => 'enterpriseca.vm' },
237
+ 'puppet_enterprise::console_host' => 'enterpriseconsole.vm',
238
+ 'console_admin_password' => 'testing123',
239
+ }
240
+ end
241
+
242
+ include_examples "overriding answers"
243
+
199
244
  it 'generates valid MEEP 1.0 json if #answer_hiera is called' do
200
245
  expect(answer_hiera).not_to be_empty
201
246
  expect { JSON.load(answer_hiera) }.not_to raise_error
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: beaker-answers
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.16.0
4
+ version: 0.17.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Puppetlabs
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2017-04-07 00:00:00.000000000 Z
12
+ date: 2017-04-24 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rspec