beaker-hostgenerator 0.7.4 → 0.8.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
- NmYzMjRkMWE1ZGRiNjY2YjRlMjkwMTBiNmNlNzI3ZWY3ZmU1MjgwOA==
4
+ YmEzODIwYWViMGE3YWQyNWZkNWRmZjNlMzdmMTA4MTVhZTVkNzY3Zg==
5
5
  data.tar.gz: !binary |-
6
- ZTZhZTg5ODkzNmMyZWU5YjczZDg1ZGU2NDkzM2RmOGFkYTU1NDQ2OA==
6
+ ZjNjY2JmOTU1ZDY4M2U2ZDE2MTE4OTlhNzIyMGI0ZWM3ZmJhNGJhZg==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- ZjVkODg1NjNhZjNmYmRmMWQ4YTY2ZDBiNTNjZDMyZjdlYTZhOWZjOTFmZmIx
10
- OTUwMmM0MTliOTM2MWRmZDQ3NTM0ODRlMTc3OTAwM2YzYjczOTRhZDM4OGRl
11
- NWY3MjdkMmQxNzIzOTZhZjk1MWU0NTYzMGRmODk4YzUxNmE4NWI=
9
+ NTAxOGZiM2ZjOGYwYTNjOGVlMzcxYWUyODliOTNlMTg1ZDU3ZTAwMWFlNTk1
10
+ NTg1YjhhYzY5MWNmYjdhODZjMTlmOTczYzU2ODk1NTNkODhjNjdhMzhhYmY0
11
+ ZmQ1YzI4MDA2MGEyNzAxOGQ1MTU1MjAzNzdhNGM2MDYxMmQ5NGE=
12
12
  data.tar.gz: !binary |-
13
- YzIzMWQzMzc3OWJlODc5NzQwNDFlZDI3ZjZlNTUwYTU3OTM4YTFhMmUwYWQy
14
- ODhmZTViMWVhOGNkMTI3Mjg4MDRhNmNhOTcxN2JlZTA3MWY3Nzk4M2M2ODYz
15
- MmRiYmMwNGRjZTM1Yjc3YTFhN2Q5YjczMzlmOGE0YmIyYTZhNmI=
13
+ NmU0ZDk4YmE1OTBkMTYyZmEzZGFhOTI2ZDcyYzVkMmJkYThmZTNlZDE5MGNh
14
+ OWJhOWM1YmE3YTgwNjNiODY4OGUyYzIwNDY0YjU5Yzg0YWVlZWMzYjg3Nzg0
15
+ OWY4N2Q1MDAwOGYwYjcyOWVmNTg0MmNiYzFkMWRjOTJmZmNhNTY=
data/CHANGELOG.md CHANGED
@@ -5,7 +5,10 @@ This project makes a strong effort to adhere to [Semantic
5
5
  Versioning](http://semver.org).
6
6
 
7
7
  ## [Unreleased][unreleased]
8
- ### Changed
8
+
9
+ ## [0.8.0] - 2016-10-4
10
+ - Improved whitespace support in global and host settings. Spaces are no longer
11
+ removed, so input must be quoted, escaped, or URL-encoded appropriately.
9
12
 
10
13
  ## [0.7.4] - 2016-9-26
11
14
  - Add platforms:
data/HISTORY.md CHANGED
@@ -1,6 +1,7 @@
1
1
  # default - History
2
2
  ## Tags
3
- * [LATEST - 26 Sep, 2016 (09c62ae1)](#LATEST)
3
+ * [LATEST - 4 Oct, 2016 (291854ec)](#LATEST)
4
+ * [0.7.4 - 26 Sep, 2016 (1e102ccd)](#0.7.4)
4
5
  * [0.7.3 - 11 Aug, 2016 (87c75523)](#0.7.3)
5
6
  * [0.7.2 - 13 Jul, 2016 (cee53bcc)](#0.7.2)
6
7
  * [0.7.1 - 29 Jun, 2016 (be332325)](#0.7.1)
@@ -17,7 +18,44 @@
17
18
  * [0.0.1 - 7 Oct, 2015 (d99251e6)](#0.0.1)
18
19
 
19
20
  ## Details
20
- ### <a name = "LATEST">LATEST - 26 Sep, 2016 (09c62ae1)
21
+ ### <a name = "LATEST">LATEST - 4 Oct, 2016 (291854ec)
22
+
23
+ * (GEM) update beaker-hostgenerator version to 0.8.0 (291854ec)
24
+
25
+ * Merge pull request #58 from puppetlabs/maint (82d9fc2a)
26
+
27
+
28
+ ```
29
+ Merge pull request #58 from puppetlabs/maint
30
+
31
+ (MAINT) Prepare for 0.8.0 release
32
+ ```
33
+ * (MAINT) Prepare for 0.8.0 release (a6346c24)
34
+
35
+ * Merge pull request #57 from puppetlabs/bk934/support-whitespace (93abe32c)
36
+
37
+
38
+ ```
39
+ Merge pull request #57 from puppetlabs/bk934/support-whitespace
40
+
41
+ (BKR-934) Allow for whitespace in settings
42
+ ```
43
+ * (BKR-934) Allow for whitespace in settings (487f3f65)
44
+
45
+
46
+ ```
47
+ (BKR-934) Allow for whitespace in settings
48
+
49
+ Previously all whitespace was automatically removed from all input. This
50
+ commit removes that behavior, allowing for values with whitespace in
51
+ them to be properly generated.
52
+
53
+ This change means users are responsible for properly quoting, escaping,
54
+ or URL-encoding the whitespace as necessary.
55
+ ```
56
+ ### <a name = "0.7.4">0.7.4 - 26 Sep, 2016 (1e102ccd)
57
+
58
+ * (HISTORY) update beaker-hostgenerator history for gem release 0.7.4 (1e102ccd)
21
59
 
22
60
  * (GEM) update beaker-hostgenerator version to 0.7.4 (09c62ae1)
23
61
 
data/README.md CHANGED
@@ -227,11 +227,12 @@ It may be necessary to URL-encode the input in order for it to properly be used
227
227
  in certain contexts, such as Jenkins.
228
228
 
229
229
  In most cases it will only be necessary to escape the characters that support
230
- arbitrary settings, which means the following three characters:
230
+ arbitrary settings, which means the following four characters:
231
231
 
232
232
  - `{` is `%7B`
233
233
  - `,` is `%2C`
234
234
  - `}` is `%7D`
235
+ - ` ` is `%20`
235
236
 
236
237
  For a full URL encoding reference see: http://www.w3schools.com/tags/ref_urlencode.asp
237
238
 
@@ -20,7 +20,7 @@ module BeakerHostGenerator
20
20
  # @returns [Hash] A complete Ruby map as defining the HOSTS and CONFIG
21
21
  # sections as required by Beaker.
22
22
  def generate(layout, options)
23
- layout = prepare_layout(layout)
23
+ layout = prepare(layout)
24
24
  tokens = tokenize_layout(layout)
25
25
  config = {}.deep_merge(BASE_CONFIG)
26
26
  nodeid = Hash.new(1)
@@ -29,7 +29,8 @@ module BeakerHostGenerator
29
29
 
30
30
  # Merge in global configuration settings
31
31
  if options[:global_config]
32
- global_config = settings_string_to_map(options[:global_config])
32
+ decoded = prepare(options[:global_config])
33
+ global_config = settings_string_to_map(decoded)
33
34
  config['CONFIG'].deep_merge!(global_config)
34
35
  end
35
36
 
@@ -11,9 +11,9 @@ module BeakerHostGenerator
11
11
  # further by other functions in this module.
12
12
  #
13
13
  # For example, given the raw user input string that defines the host layout,
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`.
14
+ # you would first prepare it for tokenization via `prepare`, then split it
15
+ # into tokens via `tokenize_layout`, and then for each token you would call
16
+ # `is_ostype_token?` and/or `parse_node_info_token`.
17
17
  module Parser
18
18
 
19
19
  # Parses a single node definition into the following components:
@@ -69,13 +69,13 @@ module BeakerHostGenerator
69
69
 
70
70
  # Prepares the host input string for tokenization, such as URL-decoding.
71
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"`.
72
+ # @param spec [String] Raw user input; well-formatted string specification
73
+ # of the hosts to generate.
74
+ # For example `"aix53-POWERfa%7Bhypervisor=aix%7D"`.
75
75
  # @returns [String] Input string with transformations necessary for
76
76
  # tokenization.
77
- def prepare_layout(layout_spec)
78
- URI.decode(layout_spec)
77
+ def prepare(spec)
78
+ URI.decode(spec)
79
79
  end
80
80
 
81
81
  # Breaks apart the host input string into chunks suitable for processing
@@ -198,7 +198,8 @@ module BeakerHostGenerator
198
198
  # configuration.
199
199
  #
200
200
  # The string is expected to be of the form "{key1=value1,key2=value2,...}".
201
- # Any whitespace found in the string will be stripped and ignored.
201
+ # Whitespace is expected to be properly quoted as it will not be treated
202
+ # any different than non-whitespace characters.
202
203
  #
203
204
  # Throws an exception of the string is malformed in any way.
204
205
  #
@@ -211,7 +212,6 @@ module BeakerHostGenerator
211
212
  settings_pairs =
212
213
  host_settings.
213
214
  delete('{}').
214
- gsub(' ', '').
215
215
  split(',').
216
216
  map { |keyvalue| keyvalue.split('=') }
217
217
 
@@ -1,5 +1,5 @@
1
1
  module BeakerHostGenerator
2
2
  module Version
3
- STRING = '0.7.4'
3
+ STRING = '0.8.0'
4
4
  end
5
5
  end
@@ -4,9 +4,9 @@ module BeakerHostGenerator
4
4
  describe Parser do
5
5
  include BeakerHostGenerator::Parser
6
6
 
7
- describe 'prepare_layout' do
7
+ describe 'prepare' do
8
8
  it 'Supports URL-encoded input' do
9
- expect( prepare_layout('centos6-64m%7Bfoo=bar-baz,this=that%7D-32a') ).
9
+ expect( prepare('centos6-64m%7Bfoo=bar-baz,this=that%7D-32a') ).
10
10
  to eq('centos6-64m{foo=bar-baz,this=that}-32a')
11
11
  end
12
12
  end
@@ -113,17 +113,16 @@ module BeakerHostGenerator
113
113
  end
114
114
 
115
115
  context 'When using arbitrary host settings' do
116
- it 'Supports arbitrary whitespace' do
117
- expect( parse_node_info_token("64{ k1=v1, k2=v2, k3 = v3 , k4 =v4 }") ).
116
+ it 'Supports arbitrary whitespace in values' do
117
+ expect( parse_node_info_token("64{k1=value 1,k2=v2,k3= v3 }") ).
118
118
  to eq({
119
119
  "roles" => "",
120
120
  "arbitrary_roles" => [],
121
121
  "bits" => "64",
122
122
  "host_settings" => {
123
- "k1" => "v1",
123
+ "k1" => "value 1",
124
124
  "k2" => "v2",
125
- "k3" => "v3",
126
- "k4" => "v4"
125
+ "k3" => " v3 "
127
126
  }
128
127
  })
129
128
  end
@@ -1,5 +1,5 @@
1
1
  ---
2
- arguments_string: "--global-config {masterless=true,number=1234} redhat7-64c{type=o-negative}"
2
+ arguments_string: "--global-config {masterless=true,number=1234,key=url%20encoded%20%20white%20space} redhat7-64c{type=o-negative}"
3
3
  environment_variables: {}
4
4
  expected_hash:
5
5
  HOSTS:
@@ -20,5 +20,6 @@ expected_hash:
20
20
  consoleport: 443
21
21
  masterless: true
22
22
  number: 1234
23
+ key: url encoded white space
23
24
  pooling_api: http://vmpooler.delivery.puppetlabs.net/
24
25
  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.4
4
+ version: 0.8.0
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-09-26 00:00:00.000000000 Z
13
+ date: 2016-10-04 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: rspec