beaker-hostgenerator 0.7.1 → 0.7.2

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
- MDBkODc5ZGJjYmRmNjUxOTcxZWYzZWE5MjVhMDliMjFhMGI4ZWNhNg==
4
+ ZTY1ZGYyYjk3YjA3YWU4ZWQwNTIzMTVhNWFhMmNhMzYwOWY3MWQ4MA==
5
5
  data.tar.gz: !binary |-
6
- YmNhNDhlYmJiN2I0Njc1NDIxNjQ0NjBmMjIwZDhkNjg0YjEyNzIxYg==
6
+ MjI3OGEyOTFhYmIxNWE4NDMwM2ZiYzkxZmRmYTM0NTBjNjg1NTNjNg==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- NWJlODExZjQwYWMwMTlhNDIwZjc5ZmRkNjY2NDA2ZTJmZjVlNjg0M2UwOTUz
10
- OWE3NTUxMjYyODk0YjIwZGY2YWE0MjAyYTE2NGYxZjhmODI4Njc5NjY0YTg5
11
- MGY4MGJiMzcyOTRmODYxM2M4YWE0MzlkYjVhZTMyZWI1ZTkyYWQ=
9
+ NjA1YzU1NTcxZDg2YjFlOGIzMGYzZWU4MWU4MTkwODRjZTcwYjE0Yzc1ZWQy
10
+ NWIwNzAwN2ExNDFiODJhNWE5ZWMxNjhhYmNiOWRlNjdlNzY4OGE5YWM1NzE2
11
+ ZmIzNWMzYzVjODBjZGNjNTc4ZGY4ZjJlNmE2ZmZhODcxM2EyNWM=
12
12
  data.tar.gz: !binary |-
13
- Y2MyM2JhZTYzYTdkYTFjYjI4MTc0NjRmZmU3ZTVkZGVhYThkOGVhMjA2ZTQz
14
- MDdiYjQzODMwODQ1MTBlNDM4YTZkMDA2NDg1NmRlYzE2MDUxNTgzOTA5MzM4
15
- MTQzMTVmYzYwZTJmMGU5ZTQ4N2M4YjRjZTRiMDZmNmYzZDMyODU=
13
+ NzQ2NjczY2FmN2Q3ZjNlMGZiNmRlN2FjNjE0ZjMwNDE4Yjk2NDM0Y2UxZmM3
14
+ MzQ1NjIzODI4YWM4NDJhMDZjOGYyZWIzYWNkY2EyMmE5MTNiNTJkYzc4ZDRh
15
+ YWQ0YzFmNWJiOWNiNjhlNWQ1OTdhZTI5MGI1NDI4NDZhZWYyNzE=
data/CHANGELOG.md CHANGED
@@ -7,6 +7,9 @@ Versioning](http://semver.org).
7
7
  ## [Unreleased][unreleased]
8
8
  ### Changed
9
9
 
10
+ ## [0.7.2] - 2016-7-13
11
+ - Automatically URL-decode input to support usage in HTTP URLs, such as Jenkins.
12
+
10
13
  ## [0.7.1] - 2016-6-29
11
14
  - Add platforms:
12
15
  - Fedora 24 x86_64 and i386
data/HISTORY.md CHANGED
@@ -1,6 +1,7 @@
1
1
  # default - History
2
2
  ## Tags
3
- * [LATEST - 29 Jun, 2016 (530baa09)](#LATEST)
3
+ * [LATEST - 13 Jul, 2016 (edc8971b)](#LATEST)
4
+ * [0.7.1 - 29 Jun, 2016 (be332325)](#0.7.1)
4
5
  * [0.7.0 - 13 Jun, 2016 (f0aafe8d)](#0.7.0)
5
6
  * [0.6.0 - 11 May, 2016 (c807eb0d)](#0.6.0)
6
7
  * [0.5.0 - 31 Mar, 2016 (fa3ae0c8)](#0.5.0)
@@ -14,7 +15,43 @@
14
15
  * [0.0.1 - 7 Oct, 2015 (d99251e6)](#0.0.1)
15
16
 
16
17
  ## Details
17
- ### <a name = "LATEST">LATEST - 29 Jun, 2016 (530baa09)
18
+ ### <a name = "LATEST">LATEST - 13 Jul, 2016 (edc8971b)
19
+
20
+ * (GEM) update beaker-hostgenerator version to 0.7.2 (edc8971b)
21
+
22
+ * (MAINT) Update CHANGELOG for 0.7.2 release (f1270d44)
23
+
24
+ * Merge pull request #44 from nwolfe/maint/master/prepare-for-release (eb45282f)
25
+
26
+
27
+ ```
28
+ Merge pull request #44 from nwolfe/maint/master/prepare-for-release
29
+
30
+ (MAINT) Update CHANGELOG for 0.7.2 release
31
+ ```
32
+ * Merge pull request #43 from nwolfe/qeng4034/support-url-encoding (e4e55d3a)
33
+
34
+
35
+ ```
36
+ Merge pull request #43 from nwolfe/qeng4034/support-url-encoding
37
+
38
+ (QENG-4034) Automatically URL-decode raw input
39
+ ```
40
+ * (QENG-4034) Automatically URL-decode raw input (e6d1c1dc)
41
+
42
+
43
+ ```
44
+ (QENG-4034) Automatically URL-decode raw input
45
+
46
+ This commit adds a "pre-processing" step to the Parser that will always
47
+ attempt to URL-decode the input before parsing it. This behavior is
48
+ necessary to support specifying arbitrary settings in the input string
49
+ when the input ends up as part of an HTTP URL, such as almost every
50
+ usage we currently have in Jenkins.
51
+ ```
52
+ ### <a name = "0.7.1">0.7.1 - 29 Jun, 2016 (be332325)
53
+
54
+ * (HISTORY) update beaker-hostgenerator history for gem release 0.7.1 (be332325)
18
55
 
19
56
  * (GEM) update beaker-hostgenerator version to 0.7.1 (530baa09)
20
57
 
data/README.md CHANGED
@@ -219,6 +219,59 @@ CONFIG:
219
219
  custom_api: http://api.custom.net
220
220
  ```
221
221
 
222
+ ### URL-encoded input
223
+
224
+ It may be necessary to URL-encode the input in order for it to properly be used
225
+ in certain contexts, such as Jenkins.
226
+
227
+ In most cases it will only be necessary to escape the characters that support
228
+ arbitrary settings, which means the following three characters: {,}
229
+
230
+ ```
231
+ $ beaker-hostgenerator centos6-64mcd-aix53-POWERfa%7Bhypervisor=aix%2Cvmhostname=pe-aix-53-acceptance.delivery.puppetlabs.net%7D
232
+ ```
233
+
234
+ Is equivalent to
235
+
236
+ ```
237
+ $ beaker-hostgenerator centos6-64mcd-aix53-POWERfa{hypervisor=aix,vmhostname=pe-aix-53-acceptance.delivery.puppetlabs.net}
238
+ ```
239
+
240
+ And will generate
241
+
242
+ ```yaml
243
+ ---
244
+ HOSTS:
245
+ centos6-64-1:
246
+ pe_dir:
247
+ pe_ver:
248
+ pe_upgrade_dir:
249
+ pe_upgrade_ver:
250
+ hypervisor: vmpooler
251
+ platform: el-6-x86_64
252
+ template: centos-6-x86_64
253
+ roles:
254
+ - agent
255
+ - master
256
+ - dashboard
257
+ - database
258
+ aix53-POWER-1:
259
+ pe_dir:
260
+ pe_ver:
261
+ pe_upgrade_dir:
262
+ pe_upgrade_ver:
263
+ platform: aix-5.3-power
264
+ hypervisor: aix
265
+ vmhostname: pe-aix-53-acceptance.delivery.puppetlabs.net
266
+ roles:
267
+ - agent
268
+ - frictionless
269
+ CONFIG:
270
+ nfs_server: none
271
+ consoleport: 443
272
+ pooling_api: http://vmpooler.delivery.puppetlabs.net/
273
+ ```
274
+
222
275
  ## Testing
223
276
 
224
277
  Beaker Host Generator currently uses both rspec and minitest tests. To run both
@@ -22,6 +22,7 @@ module BeakerHostGenerator
22
22
  # @returns [String] A complete YAML map as a string defining the HOSTS and
23
23
  # CONFIG sections as required by Beaker.
24
24
  def generate(layout, options)
25
+ layout = prepare_layout(layout)
25
26
  tokens = tokenize_layout(layout)
26
27
  config = {}.deep_merge(BASE_CONFIG)
27
28
  nodeid = Hash.new(1)
@@ -1,5 +1,6 @@
1
1
  require 'beaker-hostgenerator/data'
2
2
  require 'beaker-hostgenerator/exceptions'
3
+ require 'uri'
3
4
 
4
5
  module BeakerHostGenerator
5
6
  # Functions for parsing the raw user input host layout string and turning
@@ -10,8 +11,9 @@ module BeakerHostGenerator
10
11
  # further by other functions in this module.
11
12
  #
12
13
  # For example, given the raw user input string that defines the host layout,
13
- # you would first split it into tokens via `tokenize_layout`, and then for
14
- # each token you would call `is_ostype_token?` and/or `parse_node_info_token`.
14
+ # you would first prepare it for tokenization via `prepare_layout`, then split
15
+ # it into tokens via `tokenize_layout`, and then for each token you would
16
+ # call `is_ostype_token?` and/or `parse_node_info_token`.
15
17
  module Parser
16
18
 
17
19
  # Parses a single node definition into the following components:
@@ -65,6 +67,17 @@ module BeakerHostGenerator
65
67
 
66
68
  module_function
67
69
 
70
+ # Prepares the host input string for tokenization, such as URL-decoding.
71
+ #
72
+ # @param layout_spec [String] Raw user input; well-formatted string
73
+ # specification of the hosts to generate.
74
+ # For example `"aix53-POWERfa%7Bhypervisor=aix%7D"`.
75
+ # @returns [String] Input string with transformations necessary for
76
+ # tokenization.
77
+ def prepare_layout(layout_spec)
78
+ URI.decode(layout_spec)
79
+ end
80
+
68
81
  # Breaks apart the host input string into chunks suitable for processing
69
82
  # by the generator. Returns an array of substrings of the input spec string.
70
83
  #
@@ -1,5 +1,5 @@
1
1
  module BeakerHostGenerator
2
2
  module Version
3
- STRING = '0.7.1'
3
+ STRING = '0.7.2'
4
4
  end
5
5
  end
@@ -4,6 +4,13 @@ module BeakerHostGenerator
4
4
  describe Parser do
5
5
  include BeakerHostGenerator::Parser
6
6
 
7
+ describe 'prepare_layout' do
8
+ it 'Supports URL-encoded input' do
9
+ expect( prepare_layout('centos6-64m%7Bfoo=bar-baz,this=that%7D-32a') ).
10
+ to eq('centos6-64m{foo=bar-baz,this=that}-32a')
11
+ end
12
+ end
13
+
7
14
  describe 'parse_node_info_token' do
8
15
 
9
16
  it 'Raises InvalidNodeSpecError for invalid tokens.' do
@@ -0,0 +1,44 @@
1
+ ---
2
+ arguments_string: centos6-64mcd-aix53-POWERfa%7Bhypervisor=aix%2Cvmhostname=pe-aix-53-acceptance.delivery.puppetlabs.net%7D-POWERa%7Bfoo=bar%7D
3
+ environment_variables: {}
4
+ expected_hash:
5
+ HOSTS:
6
+ centos6-64-1:
7
+ pe_dir:
8
+ pe_ver:
9
+ pe_upgrade_dir:
10
+ pe_upgrade_ver:
11
+ hypervisor: vmpooler
12
+ platform: el-6-x86_64
13
+ template: centos-6-x86_64
14
+ roles:
15
+ - agent
16
+ - master
17
+ - dashboard
18
+ - database
19
+ aix53-POWER-1:
20
+ pe_dir:
21
+ pe_ver:
22
+ pe_upgrade_dir:
23
+ pe_upgrade_ver:
24
+ platform: aix-5.3-power
25
+ hypervisor: aix
26
+ vmhostname: pe-aix-53-acceptance.delivery.puppetlabs.net
27
+ roles:
28
+ - agent
29
+ - frictionless
30
+ aix53-POWER-2:
31
+ pe_dir:
32
+ pe_ver:
33
+ pe_upgrade_dir:
34
+ pe_upgrade_ver:
35
+ hypervisor: vmpooler
36
+ platform: aix-5.3-power
37
+ foo: bar
38
+ roles:
39
+ - agent
40
+ CONFIG:
41
+ nfs_server: none
42
+ consoleport: 443
43
+ pooling_api: http://vmpooler.delivery.puppetlabs.net/
44
+ expected_exception:
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: beaker-hostgenerator
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.7.1
4
+ version: 0.7.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Branan Purvine-Riley
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2016-06-29 00:00:00.000000000 Z
13
+ date: 2016-07-13 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: rspec
@@ -641,6 +641,7 @@ files:
641
641
  - test/fixtures/per-host-settings/arbitrary-settings.yaml
642
642
  - test/fixtures/per-host-settings/every-hypervisor.yaml
643
643
  - test/fixtures/per-host-settings/malformed-input.yaml
644
+ - test/fixtures/per-host-settings/url-encoded.yaml
644
645
  - test/fixtures/per-host-settings/with-global-settings.yaml
645
646
  - test/test_cli.rb
646
647
  - test/test_generator.rb