beaker-hostgenerator 1.18.1 → 2.0.0

Sign up to get free protection for your applications and to get access to all the features.
data/Gemfile CHANGED
@@ -10,7 +10,15 @@ group :release do
10
10
  gem 'github_changelog_generator', :require => false
11
11
  end
12
12
 
13
- group :coverage, optional: ENV['COVERAGE']!='yes' do
14
- gem 'simplecov-console', :require => false
13
+ group :coverage, optional: ENV['COVERAGE'] != 'yes' do
15
14
  gem 'codecov', :require => false
15
+ gem 'simplecov-console', :require => false
16
+ end
17
+
18
+ group :rubocop do
19
+ gem 'rubocop', '~> 1.50.2'
20
+ gem 'rubocop-minitest', '~> 0.30.0'
21
+ gem 'rubocop-performance', '~> 1.17.1'
22
+ gem 'rubocop-rake', '~> 0.6.0'
23
+ gem 'rubocop-rspec', '~> 2.20.0'
16
24
  end
data/README.md CHANGED
@@ -59,7 +59,7 @@ Below are some example usages of `beaker-hostgenerator`.
59
59
  ### Simple two-host layout
60
60
 
61
61
  ```
62
- $ beaker-hostgenerator centos6-64mdca-32a
62
+ $ beaker-hostgenerator centos9-64mdca-64a
63
63
  ```
64
64
 
65
65
  Will generate
@@ -67,27 +67,27 @@ Will generate
67
67
  ```yaml
68
68
  ---
69
69
  HOSTS:
70
- centos6-64-1:
70
+ centos9-64-1:
71
71
  pe_dir:
72
72
  pe_ver:
73
73
  pe_upgrade_dir:
74
74
  pe_upgrade_ver:
75
75
  hypervisor: vmpooler
76
- platform: el-6-x86_64
77
- template: centos-6-x86_64
76
+ platform: el-9-x86_64
77
+ template: centos-9-x86_64
78
78
  roles:
79
79
  - agent
80
80
  - master
81
81
  - database
82
82
  - dashboard
83
- centos6-32-2:
83
+ centos9-64-2:
84
84
  pe_dir:
85
85
  pe_ver:
86
86
  pe_upgrade_dir:
87
87
  pe_upgrade_ver:
88
88
  hypervisor: vmpooler
89
- platform: el-6-i386
90
- template: centos-6-i386
89
+ platform: el-9-x86_64
90
+ template: centos-9-x86_64
91
91
  roles:
92
92
  - agent
93
93
  CONFIG:
@@ -99,7 +99,7 @@ CONFIG:
99
99
  ### Single host with Arbitrary Roles
100
100
 
101
101
  ```
102
- $ beaker-hostgenerator centos6-32compile_master,another_role.ma
102
+ $ beaker-hostgenerator centos9-64compile_master,another_role.ma
103
103
  ```
104
104
 
105
105
  Will generate
@@ -107,14 +107,14 @@ Will generate
107
107
  ```yaml
108
108
  ---
109
109
  HOSTS:
110
- centos6-32-1:
110
+ centos9-64-1:
111
111
  pe_dir:
112
112
  pe_ver:
113
113
  pe_upgrade_dir:
114
114
  pe_upgrade_ver:
115
115
  hypervisor: vmpooler
116
- platform: el-6-i386
117
- template: centos-6-i386
116
+ platform: el-9-x86_64
117
+ template: centos-9-x86_64
118
118
  roles:
119
119
  - agent
120
120
  - master
@@ -133,7 +133,7 @@ CONFIG:
133
133
  ### Two hosts with multiple hypervisors and arbitrary host settings
134
134
 
135
135
  ```
136
- $ beaker-hostgenerator centos6-64m{hypervisor=none\,hostname=static-master}-redhat7-64a{somekey=some-value}
136
+ $ beaker-hostgenerator centos9-64m{hypervisor=none\,hostname=static-master}-redhat7-64a{somekey=some-value}
137
137
  ```
138
138
 
139
139
  Will generate
@@ -146,7 +146,7 @@ HOSTS:
146
146
  pe_ver:
147
147
  pe_upgrade_dir:
148
148
  pe_upgrade_ver:
149
- platform: el-6-x86_64
149
+ platform: el-9-x86_64
150
150
  hypervisor: none
151
151
  roles:
152
152
  - agent
@@ -171,7 +171,7 @@ CONFIG:
171
171
  ### Two hosts with arbitrary host settings with arbitrary lists
172
172
 
173
173
  ```
174
- $ beaker-hostgenerator centos6-64m{disks=\[16\]}-redhat7-64a{disks=\[8\,16\]}
174
+ $ beaker-hostgenerator centos9-64m{disks=\[16\]}-redhat7-64a{disks=\[8\,16\]}
175
175
  ```
176
176
 
177
177
  Will generate
@@ -179,12 +179,12 @@ Will generate
179
179
  ```yaml
180
180
  ---
181
181
  HOSTS:
182
- centos6-64-1:
182
+ centos9-64-1:
183
183
  pe_dir:
184
184
  pe_ver:
185
185
  pe_upgrade_dir:
186
186
  pe_upgrade_ver:
187
- platform: el-6-x86_64
187
+ platform: el-9-x86_64
188
188
  hypervisor: vmpooler
189
189
  disks:
190
190
  - 16
@@ -287,7 +287,7 @@ The term "custom" in this case signifies that it's not a built-in hypervisor
287
287
  ourselves as there isn't any built-in configuration for our hypervisor.
288
288
 
289
289
  ```
290
- $ beaker-hostgenerator --hypervisor=custom --global={custom_api=http://api.custom.net} centos6-64
290
+ $ beaker-hostgenerator --hypervisor=custom --global={custom_api=http://api.custom.net} centos9-64
291
291
  ```
292
292
 
293
293
  Will generate
@@ -295,12 +295,12 @@ Will generate
295
295
  ```yaml
296
296
  ---
297
297
  HOSTS:
298
- centos6-64-1:
298
+ centos9-64-1:
299
299
  pe_dir:
300
300
  pe_ver:
301
301
  pe_upgrade_dir:
302
302
  pe_upgrade_ver:
303
- platform: el-6-x86_64
303
+ platform: el-9-x86_64
304
304
  hypervisor: custom
305
305
  roles:
306
306
  - agent
@@ -328,13 +328,13 @@ arbitrary settings, which means the following characters:
328
328
  For a full URL encoding reference see: http://www.w3schools.com/tags/ref_urlencode.asp
329
329
 
330
330
  ```
331
- $ beaker-hostgenerator centos6-64mcd-aix53-POWERfa%7Bhypervisor=aix%2Cvmhostname=pe-aix-53-acceptance.delivery.puppetlabs.net%7D
331
+ $ beaker-hostgenerator centos9-64mcd-aix53-POWERfa%7Bhypervisor=aix%2Cvmhostname=pe-aix-53-acceptance.delivery.puppetlabs.net%7D
332
332
  ```
333
333
 
334
334
  Is equivalent to
335
335
 
336
336
  ```
337
- $ beaker-hostgenerator centos6-64mcd-aix53-POWERfa{hypervisor=aix,vmhostname=pe-aix-53-acceptance.delivery.puppetlabs.net}
337
+ $ beaker-hostgenerator centos9-64mcd-aix53-POWERfa{hypervisor=aix,vmhostname=pe-aix-53-acceptance.delivery.puppetlabs.net}
338
338
  ```
339
339
 
340
340
  And will generate
@@ -342,14 +342,14 @@ And will generate
342
342
  ```yaml
343
343
  ---
344
344
  HOSTS:
345
- centos6-64-1:
345
+ centos9-64-1:
346
346
  pe_dir:
347
347
  pe_ver:
348
348
  pe_upgrade_dir:
349
349
  pe_upgrade_ver:
350
350
  hypervisor: vmpooler
351
- platform: el-6-x86_64
352
- template: centos-6-x86_64
351
+ platform: el-9-x86_64
352
+ template: centos-9-x86_64
353
353
  roles:
354
354
  - agent
355
355
  - master
@@ -388,18 +388,18 @@ follows:
388
388
 
389
389
  ```yaml
390
390
  ---
391
- arguments_string: "--pe_dir /opt/hello centos6-64mdc"
391
+ arguments_string: "--pe_dir /opt/hello centos9-64mdc"
392
392
  environment_variables: {}
393
393
  expected_hash:
394
394
  HOSTS:
395
- centos6-64-1:
395
+ centos9-64-1:
396
396
  pe_dir: "/opt/hello"
397
397
  pe_ver:
398
398
  pe_upgrade_dir:
399
399
  pe_upgrade_ver:
400
400
  hypervisor: vmpooler
401
- platform: centos-6-x86_64
402
- template: centos-6-x86_64
401
+ platform: el-9-x86_64
402
+ template: centos-9-x86_64
403
403
  roles:
404
404
  - agent
405
405
  - master
data/Rakefile CHANGED
@@ -2,9 +2,7 @@ require 'rspec/core/rake_task'
2
2
  require 'rake/testtask'
3
3
 
4
4
  namespace :test do
5
-
6
5
  namespace :spec do
7
-
8
6
  task :minitest do
9
7
  desc "Run minitest tests"
10
8
  Rake::TestTask.new do |task|
@@ -27,9 +25,7 @@ namespace :test do
27
25
  t.rspec_opts = ['--color']
28
26
  t.pattern = 'spec/'
29
27
  end
30
-
31
28
  end
32
-
33
29
  end
34
30
 
35
31
  namespace :generate do
@@ -37,7 +33,7 @@ namespace :generate do
37
33
  task :fixtures do
38
34
  $LOAD_PATH.unshift(
39
35
  File.join(Dir.pwd, 'lib'),
40
- File.join(Dir.pwd, 'test')
36
+ File.join(Dir.pwd, 'test'),
41
37
  )
42
38
  require 'beaker-hostgenerator'
43
39
  require 'util/generator_helpers'
@@ -60,7 +56,7 @@ begin
60
56
  require 'github_changelog_generator/task'
61
57
  GitHubChangelogGenerator::RakeTask.new :changelog do |config|
62
58
  config.header = "# Changelog\n\nAll notable changes to this project will be documented in this file."
63
- config.exclude_labels = %w[duplicate question invalid wontfix wont-fix modulesync skip-changelog]
59
+ config.exclude_labels = %w[duplicate question invalid wontfix wont-fix modulesync skip-changelog dependencies]
64
60
  config.user = 'voxpupuli'
65
61
  config.project = 'beaker-hostgenerator'
66
62
  config.future_release = Gem::Specification.load("#{config.project}.gemspec").version
@@ -79,3 +75,14 @@ begin
79
75
  end
80
76
  rescue LoadError
81
77
  end
78
+
79
+ begin
80
+ require 'rubocop/rake_task'
81
+ rescue LoadError
82
+ # RuboCop is an optional group
83
+ else
84
+ RuboCop::RakeTask.new(:rubocop) do |task|
85
+ # These make the rubocop experience maybe slightly less terrible
86
+ task.options = ['--display-cop-names', '--display-style-guide', '--extra-details']
87
+ end
88
+ end
@@ -4,8 +4,8 @@ require 'beaker-hostgenerator/version'
4
4
  Gem::Specification.new do |s|
5
5
  s.name = "beaker-hostgenerator"
6
6
  s.version = BeakerHostGenerator::Version::STRING
7
- s.authors = ["Branan Purvine-Riley", "Wayne Warren", "Nate Wolfe"]
8
- s.email = ["qe-team@puppet.com"]
7
+ s.authors = ["Branan Purvine-Riley", "Wayne Warren", "Nate Wolfe", "Vox Pupuli"]
8
+ s.email = ["pmc@voxpupuli.org"]
9
9
  s.homepage = "https://github.com/puppetlabs/beaker-hostgenerator"
10
10
  s.summary = "Beaker Host Generator Utility"
11
11
  s.description = <<-eos
@@ -16,20 +16,22 @@ eos
16
16
  s.license = 'Apache2'
17
17
 
18
18
  s.files = `git ls-files`.split("\n").reject { |f| f.match(/^(test|spec)/) }
19
- s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
19
+ s.executables = `git ls-files -- bin/*`.split("\n").map { |f| File.basename(f) }
20
20
  s.require_paths = ["lib"]
21
21
 
22
+ s.required_ruby_version = Gem::Requirement.new('>= 2.7')
23
+
22
24
  # Testing dependencies
25
+ s.add_development_dependency 'fakefs', '>= 0.6', '< 3.0'
23
26
  s.add_development_dependency 'minitest'
27
+ s.add_development_dependency 'pry', '~> 0.10'
28
+ s.add_development_dependency 'rake', '~> 13.0'
24
29
  s.add_development_dependency 'rspec', '~> 3.0'
25
30
  s.add_development_dependency 'rspec-its'
26
- s.add_development_dependency 'fakefs', '>= 0.6', '< 2.0'
27
- s.add_development_dependency 'rake', '~> 13.0'
28
- s.add_development_dependency 'pry', '~> 0.10'
29
31
 
30
32
  # Documentation dependencies
31
- s.add_development_dependency 'yard'
32
33
  s.add_development_dependency 'thin'
34
+ s.add_development_dependency 'yard'
33
35
 
34
36
  # Run time dependencies
35
37
  s.add_runtime_dependency 'deep_merge', '~> 1.0'
@@ -8,17 +8,17 @@ module BeakerHostGenerator
8
8
  #
9
9
  # For example, given the following config (parts omitted for brevity):
10
10
  # {"HOSTS"=>
11
- # {"centos6-64-1"=>
12
- # {"template"=>"centos-6-x86_64", ...},
11
+ # {"centos9-64-1"=>
12
+ # {"template"=>"centos-9-x86_64", ...},
13
13
  # "redhat7-64-1"=>
14
14
  # {"template"=>"redhat-7-x86_64", ...},
15
- # "centos6-64-2"=>
16
- # {"template"=>"centos-6-x86_64", ...}},
15
+ # "centos9-64-2"=>
16
+ # {"template"=>"centos-9-x86_64", ...}},
17
17
  # ...
18
18
  # }}
19
19
  #
20
20
  # Returns the following map:
21
- # {"centos-6-x86_64"=>2, "redhat-7-x86_64"=>1}
21
+ # {"centos-9-x86_64"=>2, "redhat-7-x86_64"=>1}
22
22
  #
23
23
  def extract_templates(config)
24
24
  templates_hosts = config['HOSTS'].values.group_by { |h| h['template'] }
@@ -31,41 +31,41 @@ Usage: beaker-hostgenerator [options] <layout>
31
31
  <platform>-<arch>[[<arbitrary-roles>,[...]].]<roles>[{<arbitrary-settings>,[...]}][-<arch>[[<arbitrary-roles>,[...]].]<roles>[{<arbitrary-settings>,[...]}]][-<layout>]
32
32
 
33
33
  examples:
34
- centos6-64mdca-32a
35
- 1 CentOS 6 64 bit node with roles = master, database, agent, dashboard
36
- 1 CentOS 6 32 bit node with roles = agent
34
+ centos9-64mdca-64a
35
+ 1 CentOS 9 64 bit node with roles = master, database, agent, dashboard
36
+ 1 CentOS 9 64 bit node with roles = agent
37
37
 
38
- debian8-64m-32ad-32ac-centos6-64a
39
- 1 Debian 8 64 bit node with roles = master
40
- 1 Debian 8 32 bit node with roles = agent, database
41
- 1 Debian 8 32 bit node with roles = agent, dashboard
42
- 1 CentOS 6 64 bit node with roles = agent
38
+ debian11-64m-64ad-64ac-centos9-64a
39
+ 1 Debian 11 64 bit node with roles = master
40
+ 1 Debian 11 64 bit node with roles = agent, database
41
+ 1 Debian 11 64 bit node with roles = agent, dashboard
42
+ 1 CentOS 9 64 bit node with roles = agent
43
43
 
44
- debian8-64m-windows8-64a
45
- 1 Debian 8 64 bit node with roles = master
46
- 1 Windows 8 64 bit node with roles = agent
44
+ debian11-64m-windows2019_core-64a
45
+ 1 Debian 11 64 bit node with roles = master
46
+ 1 Windows 2019 64 bit node with roles = agent
47
47
 
48
48
  example with arbitrary roles:
49
- centos6-32compile_master,another_role.ma
50
- 1 CentOS 6 32 bit node with roles = master, agent, compile_master, another_role
49
+ centos9-64compile_master,another_role.ma
50
+ 1 CentOS 9 64 bit node with roles = master, agent, compile_master, another_role
51
51
 
52
52
  example with arbitrary host settings:
53
- centos6-64m{hypervisor=none\\,hostname=static1\\,my-key=my-value}-32a
54
- 1 CentOS 6 64 bit node with roles = master, hypervisor = none, node name = static1, and my-key = my-value
55
- 1 CentOS 6 32 bit node with roles = agent and the default hypervisor
53
+ centos9-64m{hypervisor=none\\,hostname=static1\\,my-key=my-value}-64a
54
+ 1 CentOS 9 64 bit node with roles = master, hypervisor = none, node name = static1, and my-key = my-value
55
+ 1 CentOS 9 64 bit node with roles = agent and the default hypervisor
56
56
 
57
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:
58
+ centos9-64m{hostname=static1\\,disks=[8,16],my-list=[my-value1]}-64a
59
+ 1 CentOS 9 64 bit node with roles = master, node name = static1 and lists:
60
60
  disks:
61
61
  - 8
62
62
  - 16
63
63
  my-list:
64
64
  - my-value1
65
- 1 CentOS 6 32 bit node with roles = agent and the default hypervisor
65
+ 1 CentOS 9 64 bit node with roles = agent and the default hypervisor
66
66
 
67
67
  Generally, it is expected that beaker-hostgenerator output will be redirected to a file, for example:
68
- beaker-hostgenerator centos6-64ma > host.cfg
68
+ beaker-hostgenerator centos9-64ma > host.cfg
69
69
 
70
70
  This can then be used in a Beaker call instead of a static Beaker config.
71
71
 
@@ -198,7 +198,7 @@ Usage: beaker-hostgenerator [options] <layout>
198
198
  result << "\n\n"
199
199
 
200
200
  result << "built-in beaker-hostgenerator host roles:\n"
201
- BeakerHostGenerator::Roles::ROLES.each do |k,v|
201
+ BeakerHostGenerator::Roles::ROLES.each do |k, v|
202
202
  result << " #{k} => #{v}\n"
203
203
  end
204
204
  result << "\n\n"