beaker-hostgenerator 2.1.0 → 2.2.0

Sign up to get free protection for your applications and to get access to all the features.
data/Rakefile CHANGED
@@ -4,22 +4,22 @@ require 'rake/testtask'
4
4
  namespace :test do
5
5
  namespace :spec do
6
6
  task :minitest do
7
- desc "Run minitest tests"
7
+ desc 'Run minitest tests'
8
8
  Rake::TestTask.new do |task|
9
- task.libs << %w(test lib)
9
+ task.libs << %w[test lib]
10
10
  task.test_files = FileList['test/test*.rb']
11
11
  task.verbose = true
12
12
  end
13
13
  end
14
14
 
15
- desc "Run spec tests"
15
+ desc 'Run spec tests'
16
16
  RSpec::Core::RakeTask.new(:run) do |t|
17
17
  t.rspec_opts = ['--color']
18
18
  t.pattern = 'spec/'
19
19
  t.ruby_opts = '-Itest'
20
20
  end
21
21
 
22
- desc "Run spec tests with coverage"
22
+ desc 'Run spec tests with coverage'
23
23
  RSpec::Core::RakeTask.new(:coverage) do |t|
24
24
  ENV['BEAKER_TEMPLATE_COVERAGE'] = 'y'
25
25
  t.rspec_opts = ['--color']
@@ -29,7 +29,7 @@ namespace :test do
29
29
  end
30
30
 
31
31
  namespace :generate do
32
- desc "Generate test fixtures."
32
+ desc 'Generate test fixtures.'
33
33
  task :fixtures do
34
34
  $LOAD_PATH.unshift(
35
35
  File.join(Dir.pwd, 'lib'),
@@ -49,8 +49,8 @@ end
49
49
  task 'test:spec' => ['test:spec:run', 'test:spec:minitest']
50
50
 
51
51
  # global defaults
52
- task :test => 'test:spec'
53
- task :default => :test
52
+ task test: 'test:spec'
53
+ task default: :test
54
54
 
55
55
  begin
56
56
  require 'github_changelog_generator/task'
@@ -1,37 +1,33 @@
1
- $LOAD_PATH.unshift File.expand_path("../lib", __FILE__)
1
+ $LOAD_PATH.unshift File.expand_path('lib', __dir__)
2
2
  require 'beaker-hostgenerator/version'
3
3
 
4
4
  Gem::Specification.new do |s|
5
- s.name = "beaker-hostgenerator"
5
+ s.name = 'beaker-hostgenerator'
6
6
  s.version = BeakerHostGenerator::Version::STRING
7
- s.authors = ["Branan Purvine-Riley", "Wayne Warren", "Nate Wolfe", "Vox Pupuli"]
8
- s.email = ["pmc@voxpupuli.org"]
9
- s.homepage = "https://github.com/puppetlabs/beaker-hostgenerator"
10
- s.summary = "Beaker Host Generator Utility"
11
- s.description = <<-eos
12
- The beaker-hostgenerator tool will take a Beaker SUT (System Under Test) spec as
13
- its first positional argument and use that to generate a Beaker host
14
- configuration file.
15
- eos
16
- s.license = 'Apache2'
7
+ s.authors = ['Branan Purvine-Riley', 'Wayne Warren', 'Nate Wolfe', 'Vox Pupuli']
8
+ s.email = ['pmc@voxpupuli.org']
9
+ s.homepage = 'https://github.com/puppetlabs/beaker-hostgenerator'
10
+ s.summary = 'Beaker Host Generator Utility'
11
+ s.description = <<~eos
12
+ The beaker-hostgenerator tool will take a Beaker SUT (System Under Test) spec as
13
+ its first positional argument and use that to generate a Beaker host
14
+ configuration file.
15
+ eos
16
+ s.license = 'Apache-2.0'
17
17
 
18
18
  s.files = `git ls-files`.split("\n").reject { |f| f.match(/^(test|spec)/) }
19
19
  s.executables = `git ls-files -- bin/*`.split("\n").map { |f| File.basename(f) }
20
- s.require_paths = ["lib"]
20
+ s.require_paths = ['lib']
21
21
 
22
22
  s.required_ruby_version = Gem::Requirement.new('>= 2.7')
23
23
 
24
24
  # Testing dependencies
25
25
  s.add_development_dependency 'fakefs', '>= 0.6', '< 3.0'
26
- s.add_development_dependency 'minitest'
26
+ s.add_development_dependency 'minitest', '~> 5.18'
27
27
  s.add_development_dependency 'pry', '~> 0.10'
28
28
  s.add_development_dependency 'rake', '~> 13.0'
29
29
  s.add_development_dependency 'rspec', '~> 3.0'
30
- s.add_development_dependency 'rspec-its'
31
-
32
- # Documentation dependencies
33
- s.add_development_dependency 'thin'
34
- s.add_development_dependency 'yard'
30
+ s.add_development_dependency 'rspec-its', '~> 1.3'
35
31
 
36
32
  # Run time dependencies
37
33
  s.add_runtime_dependency 'deep_merge', '~> 1.0'
@@ -24,52 +24,52 @@ module BeakerHostGenerator
24
24
  argv.push('--help') if argv.empty?
25
25
 
26
26
  optparse = OptionParser.new do |opts|
27
- opts.banner = <<-eos
28
- Usage: beaker-hostgenerator [options] <layout>
27
+ opts.banner = <<~eos
28
+ Usage: beaker-hostgenerator [options] <layout>
29
29
 
30
- where <layout> takes the following form:
31
- <platform>-<arch>[[<arbitrary-roles>,[...]].]<roles>[{<arbitrary-settings>,[...]}][-<arch>[[<arbitrary-roles>,[...]].]<roles>[{<arbitrary-settings>,[...]}]][-<layout>]
30
+ where <layout> takes the following form:
31
+ <platform>-<arch>[[<arbitrary-roles>,[...]].]<roles>[{<arbitrary-settings>,[...]}][-<arch>[[<arbitrary-roles>,[...]].]<roles>[{<arbitrary-settings>,[...]}]][-<layout>]
32
32
 
33
- examples:
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
33
+ examples:
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
- 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
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
- 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
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
- example with arbitrary roles:
49
- centos9-64compile_master,another_role.ma
50
- 1 CentOS 9 64 bit node with roles = master, agent, compile_master, another_role
48
+ example with arbitrary roles:
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
- example with arbitrary host settings:
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
52
+ example with arbitrary host settings:
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
- example of a list within arbitrary host settings:
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
- disks:
61
- - 8
62
- - 16
63
- my-list:
64
- - my-value1
65
- 1 CentOS 9 64 bit node with roles = agent and the default hypervisor
57
+ example of a list within arbitrary host settings:
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
+ disks:
61
+ - 8
62
+ - 16
63
+ my-list:
64
+ - my-value1
65
+ 1 CentOS 9 64 bit node with roles = agent and the default hypervisor
66
66
 
67
- Generally, it is expected that beaker-hostgenerator output will be redirected to a file, for example:
68
- beaker-hostgenerator centos9-64ma > host.cfg
67
+ Generally, it is expected that beaker-hostgenerator output will be redirected to a file, for example:
68
+ beaker-hostgenerator centos9-64ma > host.cfg
69
69
 
70
- This can then be used in a Beaker call instead of a static Beaker config.
70
+ This can then be used in a Beaker call instead of a static Beaker config.
71
71
 
72
- eos
72
+ eos
73
73
 
74
74
  opts.on('-l',
75
75
  '--list',
@@ -79,7 +79,7 @@ Usage: beaker-hostgenerator [options] <layout>
79
79
  end
80
80
 
81
81
  opts.on('--templates-only',
82
- 'Generate a reduced output including only the templates from each host.') do
82
+ 'Generate a reduced output including only the templates from each host.') do
83
83
  @options[:templates_only] = true
84
84
  end
85
85
 
@@ -110,7 +110,7 @@ Usage: beaker-hostgenerator [options] <layout>
110
110
  end
111
111
 
112
112
  opts.on('--disable-role-config',
113
- "Do not include role-specific configuration.") do
113
+ 'Do not include role-specific configuration.') do
114
114
  @options[:disable_role_config] = true
115
115
  end
116
116
 
@@ -120,19 +120,17 @@ Usage: beaker-hostgenerator [options] <layout>
120
120
  end
121
121
 
122
122
  opts.on('--osinfo-version MAJOR_VERSION',
123
- "Use OSINFO for specified beaker-hostgenerator version. " <<
124
- "Allows early access to future version of OSINFO data structure " <<
125
- "used to generate host configs.") do |version|
123
+ 'Use OSINFO for specified beaker-hostgenerator version. ' <<
124
+ 'Allows early access to future version of OSINFO data structure ' <<
125
+ 'used to generate host configs.') do |version|
126
126
  version = version.to_i
127
- if not [0, 1].include? version
128
- raise "Invalid beaker-hostgenerator version: #{version}"
129
- end
127
+ raise "Invalid beaker-hostgenerator version: #{version}" unless [0, 1].include? version
130
128
 
131
129
  @options[:osinfo_version] = version
132
130
  end
133
131
 
134
132
  opts.on('--global-config KEYVALUE_STRING',
135
- "General configuration settings to be included as-is in the " <<
133
+ 'General configuration settings to be included as-is in the ' <<
136
134
  "CONFIG section. Value should be in the form '{key=value,...}'.") do |p|
137
135
  @options[:global_config] = p
138
136
  end
@@ -204,7 +202,7 @@ Usage: beaker-hostgenerator [options] <layout>
204
202
  result << "\n\n"
205
203
 
206
204
  result << "built-in beaker-hostgenerator hypervisors:\n"
207
- BeakerHostGenerator::Hypervisor.builtin_hypervisors().keys.each do |k|
205
+ BeakerHostGenerator::Hypervisor.builtin_hypervisors.each_key do |k|
208
206
  result << " #{k}\n"
209
207
  end
210
208