beaker-hostgenerator 0.8.4 → 0.9.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 +8 -8
- data/CHANGELOG.md +10 -0
- data/HISTORY.md +96 -2
- data/README.md +47 -1
- data/lib/beaker-hostgenerator/{abs-support.rb → abs_support.rb} +0 -0
- data/lib/beaker-hostgenerator/cli.rb +11 -1
- data/lib/beaker-hostgenerator/data.rb +45 -0
- data/lib/beaker-hostgenerator/generator.rb +19 -13
- data/lib/beaker-hostgenerator/hypervisor/abs.rb +10 -5
- data/lib/beaker-hostgenerator/hypervisor/vmpooler.rb +1 -0
- data/lib/beaker-hostgenerator/parser.rb +16 -6
- data/lib/beaker-hostgenerator/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
---
|
|
2
2
|
!binary "U0hBMQ==":
|
|
3
3
|
metadata.gz: !binary |-
|
|
4
|
-
|
|
4
|
+
ODVjZTk2ZjQxN2JkMDlkYTMyNDQ3OTU2YTNkNTcyMjQ3MzYyNGQ4Nw==
|
|
5
5
|
data.tar.gz: !binary |-
|
|
6
|
-
|
|
6
|
+
MmYzZjJhNWEwYmViZTU2MjY3YmM3MDFjZDE1ODA4OGIwY2ZmMWQxNg==
|
|
7
7
|
SHA512:
|
|
8
8
|
metadata.gz: !binary |-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
9
|
+
YWM2ZjI2MGQ2ODI4MTc1YWY2OTNkZDYxN2E5ZjkwZmQ3NmZlMGUwNjk0Yzg1
|
|
10
|
+
YWJjOTc4MWRkYmJiNzA3MGQyNDBmMDE3OGMyN2UzYWUwZWM3NTc5MGE2OWIx
|
|
11
|
+
NzJhMmJmYzU4NjYwNmZjYjU0ZGI0ZWJkNWRhNmE1ZGEwODIzNjE=
|
|
12
12
|
data.tar.gz: !binary |-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
13
|
+
NDIzMzJiZjE2ZDEyNTQxNDIyZDI5MGE4ZThhMGNhNDY2OTc3OWYwYTNkY2Qw
|
|
14
|
+
ZDFjYzBkMDlkYTkxMWQwOWFjNWE4MWEwMTVlODk2NjIxYzY0MzI4ZmNjOWQ0
|
|
15
|
+
YWUxYjVmY2NkZDFlZjU1YzNlYzkwZjI1NmQzMDQzZGU0ZGEyZWE=
|
data/CHANGELOG.md
CHANGED
|
@@ -6,6 +6,16 @@ Versioning](http://semver.org).
|
|
|
6
6
|
|
|
7
7
|
## [Unreleased][unreleased]
|
|
8
8
|
|
|
9
|
+
## [0.9.0] - 2017-6-7
|
|
10
|
+
- Add list data structure support to arbitrary settings, which previously only
|
|
11
|
+
supported primitive data types.
|
|
12
|
+
- Add ability to override default hypervisor settings in the global config
|
|
13
|
+
section.
|
|
14
|
+
- Add support for hardware platforms to the ABS hypervisor.
|
|
15
|
+
- Add platforms:
|
|
16
|
+
- vro6-64
|
|
17
|
+
- vro7-64
|
|
18
|
+
|
|
9
19
|
## [0.8.4] - 2017-4-6
|
|
10
20
|
- Add platform:
|
|
11
21
|
- windows2012r2_wmf5-64
|
data/HISTORY.md
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
# worker - History
|
|
2
2
|
## Tags
|
|
3
|
-
* [LATEST -
|
|
3
|
+
* [LATEST - 7 Jun, 2017 (06b6a0da)](#LATEST)
|
|
4
|
+
* [0.8.4 - 6 Apr, 2017 (77943fb2)](#0.8.4)
|
|
4
5
|
* [0.8.3 - 7 Feb, 2017 (79e8d717)](#0.8.3)
|
|
5
6
|
* [0.8.2 - 3 Jan, 2017 (a61487bf)](#0.8.2)
|
|
6
7
|
* [0.8.1 - 21 Dec, 2016 (2648029d)](#0.8.1)
|
|
@@ -22,7 +23,100 @@
|
|
|
22
23
|
* [0.0.1 - 7 Oct, 2015 (d99251e6)](#0.0.1)
|
|
23
24
|
|
|
24
25
|
## Details
|
|
25
|
-
### <a name = "LATEST">LATEST -
|
|
26
|
+
### <a name = "LATEST">LATEST - 7 Jun, 2017 (06b6a0da)
|
|
27
|
+
|
|
28
|
+
* (GEM) update beaker-hostgenerator version to 0.9.0 (06b6a0da)
|
|
29
|
+
|
|
30
|
+
* Merge pull request #80 from puppetlabs/prepare-for-release (b7a83889)
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
```
|
|
34
|
+
Merge pull request #80 from puppetlabs/prepare-for-release
|
|
35
|
+
|
|
36
|
+
(MAINT) Update CHANGELOG for 0.9.0 release
|
|
37
|
+
```
|
|
38
|
+
* (MAINT) Update CHANGELOG for 0.9.0 release (aae2e698)
|
|
39
|
+
|
|
40
|
+
* (MAINT) Fix rendering issue in README and update TOC (bc92bd07)
|
|
41
|
+
|
|
42
|
+
* (QENG-4945) Add support for arbitrary lists (e75f1e7e)
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
```
|
|
46
|
+
(QENG-4945) Add support for arbitrary lists
|
|
47
|
+
|
|
48
|
+
Before, we had no way to add lists to configurations. This adds
|
|
49
|
+
a new bracket syntax within arbitrary settings in order to parse out any lists the user may want to
|
|
50
|
+
add in.
|
|
51
|
+
```
|
|
52
|
+
* Merge pull request #79 from puppetlabs/qeng-5041 (990b6081)
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
```
|
|
56
|
+
Merge pull request #79 from puppetlabs/qeng-5041
|
|
57
|
+
|
|
58
|
+
(QENG-5041) Add vRO to support platforms
|
|
59
|
+
```
|
|
60
|
+
* (QENG-5041) Add vRO to support platforms (22b7c670)
|
|
61
|
+
|
|
62
|
+
|
|
63
|
+
```
|
|
64
|
+
(QENG-5041) Add vRO to support platforms
|
|
65
|
+
|
|
66
|
+
This adds both vro-6-x86_64 and vro-7-x86_64. The templates
|
|
67
|
+
already exist within vmpooler
|
|
68
|
+
```
|
|
69
|
+
* Merge pull request #77 from puppetlabs/fix-default-config-hypervisors (988476e1)
|
|
70
|
+
|
|
71
|
+
|
|
72
|
+
```
|
|
73
|
+
Merge pull request #77 from puppetlabs/fix-default-config-hypervisors
|
|
74
|
+
|
|
75
|
+
(maint) The hypervisor defaults are not overwritable
|
|
76
|
+
```
|
|
77
|
+
* Merge pull request #76 from puppetlabs/qeng4965/add-abs-hardware-support (874f473f)
|
|
78
|
+
|
|
79
|
+
|
|
80
|
+
```
|
|
81
|
+
Merge pull request #76 from puppetlabs/qeng4965/add-abs-hardware-support
|
|
82
|
+
|
|
83
|
+
(QENG-4965) Add ABS support for hardware platforms
|
|
84
|
+
```
|
|
85
|
+
* (MAINT) Delete duplicate keys from test helper hash (0fe2c0ac)
|
|
86
|
+
|
|
87
|
+
* (MAINT) Prefer underscores over dashes in file names (efe8b7b1)
|
|
88
|
+
|
|
89
|
+
|
|
90
|
+
```
|
|
91
|
+
(MAINT) Prefer underscores over dashes in file names
|
|
92
|
+
|
|
93
|
+
Ruby prefers that you not use dashes in your .rb filenames, so this commit
|
|
94
|
+
renames abs-support.rb to abs_support.rb
|
|
95
|
+
```
|
|
96
|
+
* (maint) The hypervisor defaults are not overwritable (1a44141b)
|
|
97
|
+
|
|
98
|
+
|
|
99
|
+
```
|
|
100
|
+
(maint) The hypervisor defaults are not overwritable
|
|
101
|
+
Before this change the code would pull and merge the hypervisor defaults on top of any
|
|
102
|
+
user provided --global-config block. This reverses the logic to use defaults only
|
|
103
|
+
if the key is not specified in the --global-config section. This specifically
|
|
104
|
+
enables overwritting the pooling_api for the vmpooler hypervisor, as it is the
|
|
105
|
+
only one with a default global_config() method implementation. Also added it's
|
|
106
|
+
respective test
|
|
107
|
+
```
|
|
108
|
+
* (QENG-4965) Add ABS support for hardware platforms (a9ddf44b)
|
|
109
|
+
|
|
110
|
+
|
|
111
|
+
```
|
|
112
|
+
(QENG-4965) Add ABS support for hardware platforms
|
|
113
|
+
|
|
114
|
+
This commit makes the hardware platforms compatible with the ABS hypervisor and
|
|
115
|
+
the --templates-only switch to enable hardware support in Jenkins via ABS.
|
|
116
|
+
```
|
|
117
|
+
### <a name = "0.8.4">0.8.4 - 6 Apr, 2017 (77943fb2)
|
|
118
|
+
|
|
119
|
+
* (HISTORY) update beaker-hostgenerator history for gem release 0.8.4 (77943fb2)
|
|
26
120
|
|
|
27
121
|
* (GEM) update beaker-hostgenerator version to 0.8.4 (d80eb358)
|
|
28
122
|
|
data/README.md
CHANGED
|
@@ -12,6 +12,7 @@ host config files using a compact command line SUT specification.
|
|
|
12
12
|
- [Simple two-host layout](#simple-two-host-layout)
|
|
13
13
|
- [Single host with Arbitrary Roles](#single-host-with-arbitrary-roles)
|
|
14
14
|
- [Two hosts with multiple hypervisors and arbitrary host settings](#two-hosts-with-multiple-hypervisors-and-arbitrary-host-settings)
|
|
15
|
+
- [Two hosts with arbitrary host settings with arbitrary lists](#two-hosts-with-arbitrary-host-settings-with-arbitrary-lists)
|
|
15
16
|
- [Arbitrary global configuration settings](#arbitrary-global-configuration-settings)
|
|
16
17
|
- [Custom hypervisor](#custom-hypervisor)
|
|
17
18
|
- [URL-encoded input](#url-encoded-input)
|
|
@@ -157,6 +158,49 @@ CONFIG:
|
|
|
157
158
|
pooling_api: http://vmpooler.delivery.puppetlabs.net/
|
|
158
159
|
```
|
|
159
160
|
|
|
161
|
+
### Two hosts with arbitrary host settings with arbitrary lists
|
|
162
|
+
|
|
163
|
+
```
|
|
164
|
+
$ beaker-hostgenerator centos6-64m{disks=\[16\]-redhat7-64a{disks=\[8\,16\]}
|
|
165
|
+
```
|
|
166
|
+
|
|
167
|
+
Will generate
|
|
168
|
+
|
|
169
|
+
```yaml
|
|
170
|
+
---
|
|
171
|
+
HOSTS:
|
|
172
|
+
centos6-64-1:
|
|
173
|
+
pe_dir:
|
|
174
|
+
pe_ver:
|
|
175
|
+
pe_upgrade_dir:
|
|
176
|
+
pe_upgrade_ver:
|
|
177
|
+
platform: el-6-x86_64
|
|
178
|
+
hypervisor: vmpooler
|
|
179
|
+
disks:
|
|
180
|
+
- 16
|
|
181
|
+
roles:
|
|
182
|
+
- agent
|
|
183
|
+
- master
|
|
184
|
+
redhat7-64-1:
|
|
185
|
+
pe_dir:
|
|
186
|
+
pe_ver:
|
|
187
|
+
pe_upgrade_dir:
|
|
188
|
+
pe_upgrade_ver:
|
|
189
|
+
hypervisor: vmpooler
|
|
190
|
+
platform: el-7-x86_64
|
|
191
|
+
template: redhat-7-x86_64
|
|
192
|
+
disks:
|
|
193
|
+
- 8
|
|
194
|
+
- 16
|
|
195
|
+
roles:
|
|
196
|
+
- agent
|
|
197
|
+
CONFIG:
|
|
198
|
+
nfs_server: none
|
|
199
|
+
consoleport: 443
|
|
200
|
+
pooling_api: http://vmpooler.delivery.puppetlabs.net/
|
|
201
|
+
```
|
|
202
|
+
|
|
203
|
+
|
|
160
204
|
### Arbitrary global configuration settings
|
|
161
205
|
|
|
162
206
|
```
|
|
@@ -227,12 +271,14 @@ It may be necessary to URL-encode the input in order for it to properly be used
|
|
|
227
271
|
in certain contexts, such as Jenkins.
|
|
228
272
|
|
|
229
273
|
In most cases it will only be necessary to escape the characters that support
|
|
230
|
-
arbitrary settings, which means the following
|
|
274
|
+
arbitrary settings, which means the following characters:
|
|
231
275
|
|
|
232
276
|
- `{` is `%7B`
|
|
233
277
|
- `,` is `%2C`
|
|
234
278
|
- `}` is `%7D`
|
|
235
279
|
- ` ` is `%20`
|
|
280
|
+
- `[` is `%5B`
|
|
281
|
+
- `]` is `%5D`
|
|
236
282
|
|
|
237
283
|
For a full URL encoding reference see: http://www.w3schools.com/tags/ref_urlencode.asp
|
|
238
284
|
|
|
File without changes
|
|
@@ -2,7 +2,7 @@ require 'beaker-hostgenerator/generator'
|
|
|
2
2
|
require 'beaker-hostgenerator/hypervisor'
|
|
3
3
|
require 'beaker-hostgenerator/roles'
|
|
4
4
|
require 'beaker-hostgenerator/version'
|
|
5
|
-
require 'beaker-hostgenerator/
|
|
5
|
+
require 'beaker-hostgenerator/abs_support'
|
|
6
6
|
require 'optparse'
|
|
7
7
|
require 'yaml'
|
|
8
8
|
|
|
@@ -54,6 +54,16 @@ Usage: beaker-hostgenerator [options] <layout>
|
|
|
54
54
|
1 CentOS 6 64 bit node with roles = master, hypervisor = none, node name = static1, and my-key = my-value
|
|
55
55
|
1 CentOS 6 32 bit node with roles = agent and the default hypervisor
|
|
56
56
|
|
|
57
|
+
example of a list within arbitrary host settings:
|
|
58
|
+
centos6-64m{hostname=static1\\,disks=[8,16],my-list=[my-value1]}-32a
|
|
59
|
+
1 CentOS 6 64 bit node with roles = master, node name = static1 and lists:
|
|
60
|
+
disks:
|
|
61
|
+
- 8
|
|
62
|
+
- 16
|
|
63
|
+
my-list:
|
|
64
|
+
- my-value1
|
|
65
|
+
1 CentOS 6 32 bit node with roles = agent and the default hypervisor
|
|
66
|
+
|
|
57
67
|
Generally, it is expected that beaker-hostgenerator output will be redirected to a file, for example:
|
|
58
68
|
beaker-hostgenerator centos6-64ma > host.cfg
|
|
59
69
|
|
|
@@ -62,26 +62,46 @@ module BeakerHostGenerator
|
|
|
62
62
|
}
|
|
63
63
|
end
|
|
64
64
|
|
|
65
|
+
# This is where all the information for all platforms lives, irrespective
|
|
66
|
+
# of the hypervisor(s).
|
|
67
|
+
# This hash contains every OS that BHG supports as keys, and the values are
|
|
68
|
+
# hashes that contain hypervisor-specific data about that OS.
|
|
69
|
+
# Every OS also has a special "general" section for data that should always
|
|
70
|
+
# be included regardless of the hypervisor.
|
|
71
|
+
# Hypervisor implementations will then grab specific bits of data out of
|
|
72
|
+
# this hash and combine them to produce the generated hosts output.
|
|
65
73
|
def osinfo
|
|
66
74
|
{
|
|
67
75
|
'aix53-POWER' => {
|
|
68
76
|
:general => {
|
|
69
77
|
'platform' => 'aix-5.3-power'
|
|
78
|
+
},
|
|
79
|
+
:abs => {
|
|
80
|
+
'template' => 'aix-5.3-power'
|
|
70
81
|
}
|
|
71
82
|
},
|
|
72
83
|
'aix61-POWER' => {
|
|
73
84
|
:general => {
|
|
74
85
|
'platform' => 'aix-6.1-power'
|
|
86
|
+
},
|
|
87
|
+
:abs => {
|
|
88
|
+
'template' => 'aix-6.1-power'
|
|
75
89
|
}
|
|
76
90
|
},
|
|
77
91
|
'aix71-POWER' => {
|
|
78
92
|
:general => {
|
|
79
93
|
'platform' => 'aix-7.1-power'
|
|
94
|
+
},
|
|
95
|
+
:abs => {
|
|
96
|
+
'template' => 'aix-7.1-power'
|
|
80
97
|
}
|
|
81
98
|
},
|
|
82
99
|
'aix72-POWER' => {
|
|
83
100
|
:general => {
|
|
84
101
|
'platform' => 'aix-7.2-power'
|
|
102
|
+
},
|
|
103
|
+
:abs => {
|
|
104
|
+
'template' => 'aix-7.2-power'
|
|
85
105
|
}
|
|
86
106
|
},
|
|
87
107
|
'arista4-32' => {
|
|
@@ -363,6 +383,9 @@ module BeakerHostGenerator
|
|
|
363
383
|
'huaweios6-POWER' => {
|
|
364
384
|
:general => {
|
|
365
385
|
'platform' => 'huaweios-6-powerpc'
|
|
386
|
+
},
|
|
387
|
+
:abs => {
|
|
388
|
+
'template' => 'huaweios-6-powerpc'
|
|
366
389
|
}
|
|
367
390
|
},
|
|
368
391
|
'opensuse11-32' => {
|
|
@@ -628,6 +651,9 @@ module BeakerHostGenerator
|
|
|
628
651
|
'solaris10-SPARC' => {
|
|
629
652
|
:general => {
|
|
630
653
|
'platform' => 'solaris-10-sparc'
|
|
654
|
+
},
|
|
655
|
+
:abs => {
|
|
656
|
+
'template' => 'solaris-10-sparc'
|
|
631
657
|
}
|
|
632
658
|
},
|
|
633
659
|
'solaris11-32' => {
|
|
@@ -649,6 +675,9 @@ module BeakerHostGenerator
|
|
|
649
675
|
'solaris11-SPARC' => {
|
|
650
676
|
:general => {
|
|
651
677
|
'platform' => 'solaris-11-sparc'
|
|
678
|
+
},
|
|
679
|
+
:abs => {
|
|
680
|
+
'template' => 'solaris-11-sparc'
|
|
652
681
|
}
|
|
653
682
|
},
|
|
654
683
|
'solaris112-32' => {
|
|
@@ -779,6 +808,22 @@ module BeakerHostGenerator
|
|
|
779
808
|
'template' => 'ubuntu-1610-x86_64'
|
|
780
809
|
}
|
|
781
810
|
},
|
|
811
|
+
'vro6-64' => {
|
|
812
|
+
:general => {
|
|
813
|
+
'platform' => 'sles-11-x86_64'
|
|
814
|
+
},
|
|
815
|
+
:vmpooler => {
|
|
816
|
+
'template' => 'vro-6-x86_64'
|
|
817
|
+
}
|
|
818
|
+
},
|
|
819
|
+
'vro7-64' => {
|
|
820
|
+
:general => {
|
|
821
|
+
'platform' => 'sles-11-x86_64'
|
|
822
|
+
},
|
|
823
|
+
:vmpooler => {
|
|
824
|
+
'template' => 'vro-7-x86_64'
|
|
825
|
+
}
|
|
826
|
+
},
|
|
782
827
|
'windows2003-64' => {
|
|
783
828
|
:general => {
|
|
784
829
|
'platform' => 'windows-2003-64',
|
|
@@ -27,13 +27,6 @@ module BeakerHostGenerator
|
|
|
27
27
|
ostype = nil
|
|
28
28
|
bhg_version = options[:osinfo_version] || 0
|
|
29
29
|
|
|
30
|
-
# Merge in global configuration settings
|
|
31
|
-
if options[:global_config]
|
|
32
|
-
decoded = prepare(options[:global_config])
|
|
33
|
-
global_config = settings_string_to_map(decoded)
|
|
34
|
-
config['CONFIG'].deep_merge!(global_config)
|
|
35
|
-
end
|
|
36
|
-
|
|
37
30
|
tokens.each do |token|
|
|
38
31
|
if is_ostype_token?(token, bhg_version)
|
|
39
32
|
if nodeid[ostype] == 1 and ostype != nil
|
|
@@ -78,6 +71,13 @@ module BeakerHostGenerator
|
|
|
78
71
|
nodeid[ostype] += 1
|
|
79
72
|
end
|
|
80
73
|
|
|
74
|
+
# Merge in global configuration settings after the hypervisor defaults
|
|
75
|
+
if options[:global_config]
|
|
76
|
+
decoded = prepare(options[:global_config])
|
|
77
|
+
global_config = settings_string_to_map(decoded)
|
|
78
|
+
config['CONFIG'].deep_merge!(global_config)
|
|
79
|
+
end
|
|
80
|
+
|
|
81
81
|
# Munge non-string scalar values into proper data types
|
|
82
82
|
unstringify_values!(config)
|
|
83
83
|
|
|
@@ -118,30 +118,36 @@ module BeakerHostGenerator
|
|
|
118
118
|
end
|
|
119
119
|
|
|
120
120
|
# Passes over all the values of config['HOSTS'] and config['CONFIG'] and
|
|
121
|
-
#
|
|
121
|
+
# subsequent arrays to convert numbers or booleans into proper integer
|
|
122
|
+
# or boolean types.
|
|
122
123
|
def unstringify_values!(config)
|
|
123
124
|
config['HOSTS'].each do |host, settings|
|
|
124
125
|
settings.each do |k, v|
|
|
125
|
-
config['HOSTS'][host][k] =
|
|
126
|
+
config['HOSTS'][host][k] = unstringify_value(v)
|
|
126
127
|
end
|
|
127
128
|
end
|
|
128
129
|
config['CONFIG'].each do |k, v|
|
|
129
|
-
config['CONFIG'][k] =
|
|
130
|
+
config['CONFIG'][k] = unstringify_value(v)
|
|
130
131
|
end
|
|
131
132
|
end
|
|
132
133
|
|
|
133
134
|
# Attempts to convert numeric strings and boolean strings into proper
|
|
134
|
-
# integer and boolean types.
|
|
135
|
-
#
|
|
135
|
+
# integer and boolean types. If value is an array, it will recurse
|
|
136
|
+
# through those values.
|
|
137
|
+
# Returns the input value if it's not a number string or boolean string.
|
|
136
138
|
# For example "123" would be converted to 123, and "true"/"false" would be
|
|
137
139
|
# converted to true/false.
|
|
138
140
|
# The only valid boolean-strings are "true" and "false".
|
|
139
|
-
def
|
|
141
|
+
def unstringify_value(value)
|
|
140
142
|
result = Integer(value) rescue value
|
|
141
143
|
if value == 'true'
|
|
142
144
|
result = true
|
|
143
145
|
elsif value == 'false'
|
|
144
146
|
result = false
|
|
147
|
+
elsif value.kind_of?(Array)
|
|
148
|
+
value.each_with_index do |v, i|
|
|
149
|
+
result[i] = unstringify_value(v)
|
|
150
|
+
end
|
|
145
151
|
end
|
|
146
152
|
result
|
|
147
153
|
end
|
|
@@ -10,19 +10,24 @@ module BeakerHostGenerator
|
|
|
10
10
|
# determine the type of platform that's being requested.
|
|
11
11
|
#
|
|
12
12
|
# Therefore, this hypervisor just reuses the vmpooler hypervisor template
|
|
13
|
-
# values,
|
|
14
|
-
# use for non-vmpooler platforms like AIX.
|
|
13
|
+
# values, in addition to ABS-only values for hardware platforms.
|
|
15
14
|
class ABS < BeakerHostGenerator::Hypervisor::Interface
|
|
16
15
|
include BeakerHostGenerator::Data
|
|
17
16
|
|
|
18
17
|
def generate_node(node_info, base_config, bhg_version)
|
|
19
18
|
base_config['hypervisor'] = 'abs'
|
|
20
19
|
|
|
21
|
-
#
|
|
20
|
+
# Grab vmpooler data for this platform and any hardware (ABS) data.
|
|
21
|
+
# The assumption here is that these are mutually exclusive; that is,
|
|
22
|
+
# any given platform will have *either* :vmpooler data or :abs data
|
|
23
|
+
# so we're not worried about one overriding the other when we merge
|
|
24
|
+
# the hashes together.
|
|
22
25
|
platform = node_info['platform']
|
|
23
|
-
|
|
26
|
+
vmpooler_platform_info = get_platform_info(bhg_version, platform, :vmpooler)
|
|
27
|
+
abs_platform_info = get_platform_info(bhg_version, platform, :abs)
|
|
24
28
|
|
|
25
|
-
base_config.deep_merge!
|
|
29
|
+
base_config.deep_merge! vmpooler_platform_info
|
|
30
|
+
base_config.deep_merge! abs_platform_info
|
|
26
31
|
|
|
27
32
|
return base_config
|
|
28
33
|
end
|
|
@@ -28,7 +28,7 @@ module BeakerHostGenerator
|
|
|
28
28
|
# Examples: m, mdca
|
|
29
29
|
#
|
|
30
30
|
# * host_settings Any character (see `settings_string_to_map` for details)
|
|
31
|
-
# Examples: {hostname=foo-bar, ip.address=123.4.5.6}
|
|
31
|
+
# Examples: {hostname=foo-bar, ip.address=123.4.5.6, foo=[bar,baz]}
|
|
32
32
|
#
|
|
33
33
|
# This regex is the main workhorse for parsing input to beaker-hostgenerator.
|
|
34
34
|
# There is a bit of pre and post parsing that happens before and after this
|
|
@@ -100,11 +100,11 @@ module BeakerHostGenerator
|
|
|
100
100
|
# "centos6-64m{hostname=foo|bar}-debian8-32"
|
|
101
101
|
#
|
|
102
102
|
# Which we can then simply split on - into:
|
|
103
|
-
# ["centos6", "
|
|
103
|
+
# ["centos6", "64m{hostname=foo|bar}", "debian8", "32"]
|
|
104
104
|
#
|
|
105
105
|
# And then finally turn the | back into - now that we've
|
|
106
106
|
# properly decomposed the spec string:
|
|
107
|
-
# ["centos6", "
|
|
107
|
+
# ["centos6", "64m{hostname=foo-bar}", "debian8", "32"]
|
|
108
108
|
#
|
|
109
109
|
# NOTE we've specifically chosen to use the pipe character |
|
|
110
110
|
# due to its unlikely occurrence in the user input string.
|
|
@@ -197,7 +197,7 @@ module BeakerHostGenerator
|
|
|
197
197
|
# to a proper hash map data structure for merging into the host
|
|
198
198
|
# configuration.
|
|
199
199
|
#
|
|
200
|
-
# The string is expected to be of the form "{key1=value1,key2=
|
|
200
|
+
# The string is expected to be of the form "{key1=value1,key2=[v2,v3],...}".
|
|
201
201
|
# Whitespace is expected to be properly quoted as it will not be treated
|
|
202
202
|
# any different than non-whitespace characters.
|
|
203
203
|
#
|
|
@@ -206,13 +206,14 @@ module BeakerHostGenerator
|
|
|
206
206
|
# @param host_settings [String] Non-nil user input string that defines host
|
|
207
207
|
# specific settings.
|
|
208
208
|
#
|
|
209
|
-
# @returns [Hash{String=>String}] The host_settings string as a map.
|
|
209
|
+
# @returns [Hash{String=>String|Array}] The host_settings string as a map.
|
|
210
210
|
def settings_string_to_map(host_settings)
|
|
211
211
|
# Strip it down to a list of pairs
|
|
212
|
+
# Splitting on all commas except inside `[]`
|
|
212
213
|
settings_pairs =
|
|
213
214
|
host_settings.
|
|
214
215
|
delete('{}').
|
|
215
|
-
split(
|
|
216
|
+
split(/,(?=[^\]]*(?:\[|$))/).
|
|
216
217
|
map { |keyvalue| keyvalue.split('=') }
|
|
217
218
|
|
|
218
219
|
# Validate they're actually pairs, and that all keys are non-empty
|
|
@@ -227,6 +228,15 @@ module BeakerHostGenerator
|
|
|
227
228
|
end
|
|
228
229
|
end
|
|
229
230
|
|
|
231
|
+
# Replace the remaining `,` to make array for arbitrary list if brackets exist
|
|
232
|
+
settings_pairs.each do |pair|
|
|
233
|
+
if pair[1].include?("[")
|
|
234
|
+
pair[1] = pair[1].
|
|
235
|
+
delete('[]').
|
|
236
|
+
split(',')
|
|
237
|
+
end
|
|
238
|
+
end
|
|
239
|
+
|
|
230
240
|
Hash[settings_pairs]
|
|
231
241
|
end
|
|
232
242
|
end
|
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.
|
|
4
|
+
version: 0.9.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: 2017-
|
|
13
|
+
date: 2017-06-07 00:00:00.000000000 Z
|
|
14
14
|
dependencies:
|
|
15
15
|
- !ruby/object:Gem::Dependency
|
|
16
16
|
name: minitest
|
|
@@ -204,7 +204,7 @@ files:
|
|
|
204
204
|
- bin/beaker-hostgenerator
|
|
205
205
|
- bin/genconfig2
|
|
206
206
|
- lib/beaker-hostgenerator.rb
|
|
207
|
-
- lib/beaker-hostgenerator/
|
|
207
|
+
- lib/beaker-hostgenerator/abs_support.rb
|
|
208
208
|
- lib/beaker-hostgenerator/cli.rb
|
|
209
209
|
- lib/beaker-hostgenerator/data.rb
|
|
210
210
|
- lib/beaker-hostgenerator/exceptions.rb
|