hammer_cli_foreman 0.17.2 → 0.18.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 +4 -4
- data/doc/host_create.md +17 -17
- data/doc/release_notes.md +19 -6
- data/lib/hammer_cli_foreman/command_extensions.rb +2 -3
- data/lib/hammer_cli_foreman/command_extensions/fields.rb +13 -0
- data/lib/hammer_cli_foreman/command_extensions/hosts.rb +1 -0
- data/lib/hammer_cli_foreman/command_extensions/hosts/help.rb +2 -0
- data/lib/hammer_cli_foreman/command_extensions/hosts/help/compute_resources.rb +85 -0
- data/lib/hammer_cli_foreman/command_extensions/hosts/help/interfaces.rb +55 -0
- data/lib/hammer_cli_foreman/commands.rb +111 -0
- data/lib/hammer_cli_foreman/common_parameter.rb +4 -2
- data/lib/hammer_cli_foreman/compute_attribute.rb +20 -36
- data/lib/hammer_cli_foreman/compute_resource.rb +5 -25
- data/lib/hammer_cli_foreman/compute_resource/base.rb +6 -4
- data/lib/hammer_cli_foreman/compute_resource/ec2.rb +10 -9
- data/lib/hammer_cli_foreman/compute_resource/gce.rb +22 -8
- data/lib/hammer_cli_foreman/compute_resource/libvirt.rb +14 -15
- data/lib/hammer_cli_foreman/compute_resource/openstack.rb +11 -9
- data/lib/hammer_cli_foreman/compute_resource/ovirt.rb +22 -17
- data/lib/hammer_cli_foreman/compute_resource/rackspace.rb +9 -6
- data/lib/hammer_cli_foreman/compute_resource/register_compute_resources.rb +1 -2
- data/lib/hammer_cli_foreman/compute_resource/utils.rb +27 -0
- data/lib/hammer_cli_foreman/compute_resource/vmware.rb +46 -37
- data/lib/hammer_cli_foreman/host.rb +30 -7
- data/lib/hammer_cli_foreman/hosts/common_update_options.rb +16 -1
- data/lib/hammer_cli_foreman/image.rb +1 -0
- data/lib/hammer_cli_foreman/option_builders.rb +46 -0
- data/lib/hammer_cli_foreman/option_sources.rb +2 -0
- data/lib/hammer_cli_foreman/option_sources/fields_params.rb +20 -0
- data/lib/hammer_cli_foreman/option_sources/new_params.rb +26 -0
- data/lib/hammer_cli_foreman/report_template.rb +6 -2
- data/lib/hammer_cli_foreman/version.rb +1 -1
- data/locale/ca/LC_MESSAGES/hammer-cli-foreman.mo +0 -0
- data/locale/de/LC_MESSAGES/hammer-cli-foreman.mo +0 -0
- data/locale/en/LC_MESSAGES/hammer-cli-foreman.mo +0 -0
- data/locale/en_GB/LC_MESSAGES/hammer-cli-foreman.mo +0 -0
- data/locale/es/LC_MESSAGES/hammer-cli-foreman.mo +0 -0
- data/locale/fr/LC_MESSAGES/hammer-cli-foreman.mo +0 -0
- data/locale/it/LC_MESSAGES/hammer-cli-foreman.mo +0 -0
- data/locale/ja/LC_MESSAGES/hammer-cli-foreman.mo +0 -0
- data/locale/ko/LC_MESSAGES/hammer-cli-foreman.mo +0 -0
- data/locale/pt_BR/LC_MESSAGES/hammer-cli-foreman.mo +0 -0
- data/locale/ru/LC_MESSAGES/hammer-cli-foreman.mo +0 -0
- data/locale/zh_CN/LC_MESSAGES/hammer-cli-foreman.mo +0 -0
- data/locale/zh_TW/LC_MESSAGES/hammer-cli-foreman.mo +0 -0
- data/test/data/1.22/foreman_api.json +1 -1
- data/test/functional/host_test.rb +89 -0
- data/test/functional/report_template_test.rb +19 -0
- data/test/unit/commands_test.rb +24 -1
- metadata +13 -7
- data/lib/hammer_cli_foreman/compute_resource/help_utils.rb +0 -34
- data/lib/hammer_cli_foreman/hosts/common_update_help.rb +0 -47
@@ -32,9 +32,11 @@ module HammerCLIForeman
|
|
32
32
|
:default => 'string',
|
33
33
|
:format => HammerCLI::Options::Normalizers::Enum.new(Parameter::KEY_TYPES)
|
34
34
|
|
35
|
-
|
35
|
+
attr_reader :action
|
36
|
+
|
37
|
+
def execute
|
36
38
|
@action ||= parameter_exist? ? :update : :create
|
37
|
-
|
39
|
+
super
|
38
40
|
end
|
39
41
|
|
40
42
|
def success_message
|
@@ -1,6 +1,6 @@
|
|
1
|
-
require 'hammer_cli_foreman/image'
|
2
1
|
require 'hammer_cli_foreman/compute_resource/register_compute_resources'
|
3
|
-
require 'hammer_cli_foreman/compute_resource/
|
2
|
+
require 'hammer_cli_foreman/compute_resource/utils'
|
3
|
+
require 'hammer_cli_foreman/image'
|
4
4
|
|
5
5
|
module HammerCLIForeman
|
6
6
|
class ComputeAttribute < HammerCLIForeman::Command
|
@@ -22,7 +22,7 @@ module HammerCLIForeman
|
|
22
22
|
end
|
23
23
|
|
24
24
|
class Create < HammerCLIForeman::CreateCommand
|
25
|
-
|
25
|
+
desc _('Create compute profile set of values')
|
26
26
|
|
27
27
|
option '--compute-attributes', 'COMPUTE_ATTRS', _('Compute resource attributes'),
|
28
28
|
:format => HammerCLI::Options::Normalizers::KeyValueList.new
|
@@ -31,10 +31,6 @@ module HammerCLIForeman
|
|
31
31
|
option '--volume', 'VOLUME', _('Volume parameters, should be comma separated list of values'),
|
32
32
|
:format => HammerCLI::Options::Normalizers::KeyValueList.new, :multivalued => true
|
33
33
|
|
34
|
-
extend_help do |h|
|
35
|
-
::HammerCLIForeman::ComputeResources.extend_help(h, :all)
|
36
|
-
end
|
37
|
-
|
38
34
|
validate_options do
|
39
35
|
any(:option_compute_profile_id, :option_compute_profile_name ).required
|
40
36
|
any(:option_compute_resource_id, :option_compute_resource_name).required
|
@@ -42,7 +38,7 @@ module HammerCLIForeman
|
|
42
38
|
|
43
39
|
def request_params
|
44
40
|
params = super
|
45
|
-
compute_resource_name = HammerCLIForeman.
|
41
|
+
compute_resource_name = HammerCLIForeman::ComputeResources.resource_provider(options['option_compute_resource_id'])
|
46
42
|
interfaces_attr_name = ::HammerCLIForeman.compute_resources[compute_resource_name].interfaces_attrs_name
|
47
43
|
params['compute_attribute']['vm_attrs'] = option_compute_attributes || {}
|
48
44
|
params['compute_attribute']['vm_attrs'][interfaces_attr_name]= HammerCLIForeman::ComputeAttribute.attribute_hash(option_interface_list) unless option_interface_list.empty?
|
@@ -53,6 +49,8 @@ module HammerCLIForeman
|
|
53
49
|
success_message _('Compute profile attributes are set.')
|
54
50
|
failure_message _('Could not set the compute profile attributes')
|
55
51
|
build_options
|
52
|
+
|
53
|
+
extend_with(HammerCLIForeman::CommandExtensions::Hosts::Help::ComputeResources.new)
|
56
54
|
end
|
57
55
|
|
58
56
|
class Update < HammerCLIForeman::UpdateCommand
|
@@ -65,20 +63,15 @@ module HammerCLIForeman
|
|
65
63
|
option '--volume', 'VOLUME', _('Volume parameters, should be comma separated list of values'),
|
66
64
|
:format => HammerCLI::Options::Normalizers::KeyValueList.new, :multivalued => true
|
67
65
|
|
68
|
-
extend_help do |h|
|
69
|
-
::HammerCLIForeman::ComputeResources.extend_help(h, :all)
|
70
|
-
end
|
71
|
-
|
72
66
|
validate_options do
|
73
67
|
any(:option_compute_profile_id, :option_compute_profile_name ).required
|
74
68
|
any(:option_compute_resource_id, :option_compute_resource_name).required
|
75
69
|
end
|
76
70
|
|
77
|
-
|
78
71
|
def request_params
|
79
72
|
|
80
73
|
params = HammerCLIForeman::ComputeAttribute.get_params(options)
|
81
|
-
compute_resource_name = HammerCLIForeman.
|
74
|
+
compute_resource_name = HammerCLIForeman::ComputeResources.resource_provider(options['option_compute_resource_id'])
|
82
75
|
interfaces_attr_name = ::HammerCLIForeman.compute_resources[compute_resource_name].interfaces_attrs_name
|
83
76
|
|
84
77
|
raise ArgumentError, "Compute profile value to update does not exist yet; it needs to be created first" if !params['compute_attribute'].key?('id')
|
@@ -102,6 +95,8 @@ module HammerCLIForeman
|
|
102
95
|
failure_message _('Could not update the compute profile attributes')
|
103
96
|
|
104
97
|
build_options :without => :id
|
98
|
+
|
99
|
+
extend_with(HammerCLIForeman::CommandExtensions::Hosts::Help::ComputeResources.new)
|
105
100
|
end
|
106
101
|
|
107
102
|
# Using the Update command because adding a new interface is done by modifying existing compute_attribute
|
@@ -111,10 +106,6 @@ module HammerCLIForeman
|
|
111
106
|
option '--interface', 'SET_VALUES', _('Interface parameters, should be comma separated list of values'),
|
112
107
|
:format => HammerCLI::Options::Normalizers::KeyValueList.new, :required => true
|
113
108
|
|
114
|
-
extend_help do |h|
|
115
|
-
::HammerCLIForeman::ComputeResources.extend_help(h, :interface)
|
116
|
-
end
|
117
|
-
|
118
109
|
def validate_options
|
119
110
|
super
|
120
111
|
validator.any(:option_compute_profile_id,:option_compute_profile_name).required
|
@@ -125,9 +116,7 @@ module HammerCLIForeman
|
|
125
116
|
params = HammerCLIForeman::ComputeAttribute.get_params(options)
|
126
117
|
|
127
118
|
raise ArgumentError, "Compute profile value to update does not exist yet; it needs to be created first" if !params['compute_attribute'].key?('id')
|
128
|
-
compute_resource_name = HammerCLIForeman.
|
129
|
-
|
130
|
-
|
119
|
+
compute_resource_name = HammerCLIForeman::ComputeResources.resource_provider(options['option_compute_resource_id'])
|
131
120
|
interfaces_attr_name = ::HammerCLIForeman.compute_resources[compute_resource_name].interfaces_attrs_name
|
132
121
|
interface_attr = params['compute_attribute']['vm_attrs'][interfaces_attr_name] || {}
|
133
122
|
new_interface_id = (interface_attr.keys.max.to_i + 1 ).to_s if interface_attr.any?
|
@@ -143,6 +132,8 @@ module HammerCLIForeman
|
|
143
132
|
failure_message _('Could not create interface')
|
144
133
|
|
145
134
|
build_options :without => :id
|
135
|
+
|
136
|
+
extend_with(HammerCLIForeman::CommandExtensions::Hosts::Help::ComputeResources.custom(attributes: :interface).new)
|
146
137
|
end
|
147
138
|
|
148
139
|
class UpdateInterface < HammerCLIForeman::UpdateCommand
|
@@ -157,10 +148,6 @@ module HammerCLIForeman
|
|
157
148
|
:required => true,
|
158
149
|
:format => HammerCLI::Options::Normalizers::Number.new
|
159
150
|
|
160
|
-
extend_help do |h|
|
161
|
-
::HammerCLIForeman::ComputeResources.extend_help(h, :interface)
|
162
|
-
end
|
163
|
-
|
164
151
|
def validate_options
|
165
152
|
super
|
166
153
|
validator.any(:option_compute_profile_id, :option_compute_profile_name).required
|
@@ -170,7 +157,7 @@ module HammerCLIForeman
|
|
170
157
|
def request_params
|
171
158
|
params = HammerCLIForeman::ComputeAttribute.get_params(options)
|
172
159
|
raise ArgumentError, "Compute profile value to update does not exist yet; it needs to be created first" if !params['compute_attribute'].key?('id')
|
173
|
-
compute_resource_name = HammerCLIForeman.
|
160
|
+
compute_resource_name = HammerCLIForeman::ComputeResources.resource_provider(options['option_compute_resource_id'])
|
174
161
|
interfaces_attr_name = ::HammerCLIForeman.compute_resources[compute_resource_name].interfaces_attrs_name
|
175
162
|
params['id'] = params['compute_attribute']['id']
|
176
163
|
params['compute_attribute']['vm_attrs'][interfaces_attr_name] ||= {}
|
@@ -180,6 +167,8 @@ module HammerCLIForeman
|
|
180
167
|
success_message _('Interface was updated.')
|
181
168
|
failure_message _('Could not update interface')
|
182
169
|
build_options :without => :id
|
170
|
+
|
171
|
+
extend_with(HammerCLIForeman::CommandExtensions::Hosts::Help::ComputeResources.custom(attributes: :interface).new)
|
183
172
|
end
|
184
173
|
|
185
174
|
# Using the Update command because removing an interface is done by modifying existing compute_attribute
|
@@ -198,7 +187,7 @@ module HammerCLIForeman
|
|
198
187
|
def request_params
|
199
188
|
params = HammerCLIForeman::ComputeAttribute.get_params(options)
|
200
189
|
raise ArgumentError, "Compute profile value to update does not exist yet; it needs to be created first" if !params['compute_attribute'].key?('id')
|
201
|
-
compute_resource_name = HammerCLIForeman.
|
190
|
+
compute_resource_name = HammerCLIForeman::ComputeResources.resource_provider(options['option_compute_resource_id'])
|
202
191
|
interfaces_attr_name = ::HammerCLIForeman.compute_resources[compute_resource_name].interfaces_attrs_name
|
203
192
|
params['id'] = params['compute_attribute']['id']
|
204
193
|
if params['compute_attribute']['vm_attrs'][interfaces_attr_name].has_key?(option_interface_id.to_s)
|
@@ -221,10 +210,6 @@ module HammerCLIForeman
|
|
221
210
|
option '--volume', 'VOLUME', _('Volume parameters, should be comma separated list of values'),
|
222
211
|
:format => HammerCLI::Options::Normalizers::KeyValueList.new, :required => true
|
223
212
|
|
224
|
-
extend_help do |h|
|
225
|
-
::HammerCLIForeman::ComputeResources.extend_help(h, :volume)
|
226
|
-
end
|
227
|
-
|
228
213
|
def validate_options
|
229
214
|
super
|
230
215
|
validator.any(:option_compute_profile_id, :option_compute_profile_name).required
|
@@ -246,6 +231,8 @@ module HammerCLIForeman
|
|
246
231
|
success_message _('Volume was created.')
|
247
232
|
failure_message _('Could not create volume')
|
248
233
|
build_options :without => :id
|
234
|
+
|
235
|
+
extend_with(HammerCLIForeman::CommandExtensions::Hosts::Help::ComputeResources.custom(attributes: :volume).new)
|
249
236
|
end
|
250
237
|
|
251
238
|
class UpdateVolume < HammerCLIForeman::UpdateCommand
|
@@ -259,11 +246,6 @@ module HammerCLIForeman
|
|
259
246
|
:required => true,
|
260
247
|
:format => HammerCLI::Options::Normalizers::Number.new
|
261
248
|
|
262
|
-
extend_help do |h|
|
263
|
-
::HammerCLIForeman::ComputeResources.extend_help(h, :volume)
|
264
|
-
end
|
265
|
-
|
266
|
-
|
267
249
|
def validate_options
|
268
250
|
super
|
269
251
|
validator.any(:option_compute_profile_id, :option_compute_profile_name).required
|
@@ -281,6 +263,8 @@ module HammerCLIForeman
|
|
281
263
|
success_message _('Volume was updated.')
|
282
264
|
failure_message _('Could not update volume')
|
283
265
|
build_options :without => :id
|
266
|
+
|
267
|
+
extend_with(HammerCLIForeman::CommandExtensions::Hosts::Help::ComputeResources.custom(attributes: :volume).new)
|
284
268
|
end
|
285
269
|
|
286
270
|
# Using the Update command because removing a volume is done by modifying existing compute_attribute
|
@@ -1,7 +1,6 @@
|
|
1
1
|
require 'hammer_cli_foreman/image'
|
2
2
|
require 'hammer_cli_foreman/compute_resource/register_compute_resources'
|
3
3
|
|
4
|
-
|
5
4
|
module HammerCLIForeman
|
6
5
|
|
7
6
|
class ComputeResource < HammerCLIForeman::Command
|
@@ -31,27 +30,6 @@ module HammerCLIForeman
|
|
31
30
|
class InfoCommand < HammerCLIForeman::InfoCommand
|
32
31
|
include ProviderNameLegacy
|
33
32
|
|
34
|
-
PROVIDER_SPECIFIC_FIELDS = {
|
35
|
-
'ovirt' => [
|
36
|
-
Fields::Field.new(:label => _('Datacenter'), :path => [:datacenter])
|
37
|
-
],
|
38
|
-
'ec2' => [
|
39
|
-
Fields::Field.new(:label => _('Region'), :path => [:region])
|
40
|
-
],
|
41
|
-
'vmware' => [
|
42
|
-
Fields::Field.new(:label => _('Datacenter'), :path => [:datacenter]),
|
43
|
-
Fields::Field.new(:label => _('Server'), :path => [:server])
|
44
|
-
],
|
45
|
-
'openstack' => [
|
46
|
-
Fields::Field.new(:label => _('Tenant'), :path => [:tenant])
|
47
|
-
],
|
48
|
-
'rackspace' => [
|
49
|
-
Fields::Field.new(:label => _('Region'), :path => [:region])
|
50
|
-
],
|
51
|
-
'libvirt' => [
|
52
|
-
]
|
53
|
-
}
|
54
|
-
|
55
33
|
output ListCommand.output_definition do
|
56
34
|
field :url, _("Url")
|
57
35
|
field :description, _("Description")
|
@@ -61,9 +39,11 @@ module HammerCLIForeman
|
|
61
39
|
end
|
62
40
|
|
63
41
|
def print_data(data)
|
64
|
-
provider = data[
|
65
|
-
|
66
|
-
|
42
|
+
provider = ::HammerCLIForeman.compute_resources[data['provider'].downcase]
|
43
|
+
if provider
|
44
|
+
output_definition.fields.concat(provider.provider_specific_fields || [])
|
45
|
+
super(data)
|
46
|
+
end
|
67
47
|
end
|
68
48
|
|
69
49
|
build_options
|
@@ -1,12 +1,14 @@
|
|
1
1
|
module HammerCLIForeman
|
2
2
|
module ComputeResources
|
3
3
|
class Base
|
4
|
-
|
4
|
+
def name; ''; end
|
5
5
|
def compute_attributes; []; end
|
6
6
|
def interface_attributes; []; end
|
7
7
|
def volume_attributes; []; end
|
8
|
-
def interfaces_attrs_name;
|
9
|
-
def
|
8
|
+
def interfaces_attrs_name; 'interfaces_attributes'; end
|
9
|
+
def host_attributes; []; end
|
10
|
+
def provider_specific_fields; []; end
|
11
|
+
def mandatory_resource_options; %i[name provider]; end
|
10
12
|
end
|
11
13
|
end
|
12
|
-
end
|
14
|
+
end
|
@@ -2,23 +2,24 @@ module HammerCLIForeman
|
|
2
2
|
module ComputeResources
|
3
3
|
class EC2 < Base
|
4
4
|
def name
|
5
|
-
|
5
|
+
'EC2'
|
6
6
|
end
|
7
7
|
|
8
8
|
def compute_attributes
|
9
|
+
%w[flavor_id image_id availability_zone security_group_ids managed_ip]
|
10
|
+
end
|
11
|
+
|
12
|
+
def provider_specific_fields
|
9
13
|
[
|
10
|
-
|
11
|
-
'image_id',
|
12
|
-
'availability_zone',
|
13
|
-
'security_group_ids',
|
14
|
-
'managed_ip'
|
14
|
+
Fields::Field.new(:label => _('Region'), :path => [:region])
|
15
15
|
]
|
16
16
|
end
|
17
17
|
|
18
18
|
def mandatory_resource_options
|
19
|
-
super + [
|
19
|
+
super + %i[region user password]
|
20
20
|
end
|
21
21
|
end
|
22
|
-
|
22
|
+
|
23
|
+
HammerCLIForeman.register_compute_resource('ec2', EC2.new)
|
23
24
|
end
|
24
|
-
end
|
25
|
+
end
|
@@ -2,22 +2,36 @@ module HammerCLIForeman
|
|
2
2
|
module ComputeResources
|
3
3
|
class GCE < Base
|
4
4
|
def name
|
5
|
-
|
5
|
+
'GCE'
|
6
6
|
end
|
7
7
|
|
8
8
|
def compute_attributes
|
9
|
+
%w[machine_type image_id network associate_external_ip]
|
10
|
+
end
|
11
|
+
|
12
|
+
def interfaces_attrs_name
|
13
|
+
'network_interfaces_nics_attributes'
|
14
|
+
end
|
15
|
+
|
16
|
+
def volume_attributes
|
9
17
|
[
|
10
|
-
|
11
|
-
'image_id',
|
12
|
-
'network',
|
13
|
-
'external_ip'
|
18
|
+
['size_gb', _('Volume size in GB, integer value')]
|
14
19
|
]
|
15
20
|
end
|
16
21
|
|
17
|
-
def
|
18
|
-
|
22
|
+
def provider_specific_fields
|
23
|
+
[
|
24
|
+
Fields::Field.new(:label => _('Project'), :path => [:project]),
|
25
|
+
Fields::Field.new(:label => _('Email'), :path => [:email]),
|
26
|
+
Fields::Field.new(:label => _('Key Path'), :path => [:key_path]),
|
27
|
+
]
|
28
|
+
end
|
29
|
+
|
30
|
+
def mandatory_resource_options
|
31
|
+
super + %I{project key_path zone}
|
19
32
|
end
|
20
33
|
end
|
34
|
+
|
21
35
|
HammerCLIForeman.register_compute_resource('gce', GCE.new)
|
22
36
|
end
|
23
|
-
end
|
37
|
+
end
|
@@ -2,48 +2,47 @@ module HammerCLIForeman
|
|
2
2
|
module ComputeResources
|
3
3
|
class Libvirt < Base
|
4
4
|
def name
|
5
|
-
|
5
|
+
'Libvirt'
|
6
6
|
end
|
7
7
|
|
8
8
|
def compute_attributes
|
9
9
|
[
|
10
|
-
|
11
|
-
|
12
|
-
['start', _('Boolean (expressed as 0 or 1), whether to start the machine or not')]
|
10
|
+
['cpus', _('Number of CPUs')],
|
11
|
+
['memory', _('String, amount of memory, value in bytes')]
|
13
12
|
]
|
14
13
|
end
|
15
14
|
|
16
15
|
def host_attributes
|
17
16
|
[
|
18
|
-
|
17
|
+
['start', _('Boolean (expressed as 0 or 1), whether to start the machine or not')]
|
19
18
|
]
|
20
19
|
end
|
21
20
|
|
22
21
|
def interface_attributes
|
23
22
|
[
|
24
|
-
|
25
|
-
|
26
|
-
|
23
|
+
['type', _('Possible values: %s') % 'bridge, network'],
|
24
|
+
['bridge', _('Name of interface according to type')],
|
25
|
+
['model', _('Possible values: %s') % 'virtio, rtl8139, ne2k_pci, pcnet, e1000']
|
27
26
|
]
|
28
27
|
end
|
29
28
|
|
30
29
|
def volume_attributes
|
31
30
|
[
|
32
|
-
|
33
|
-
|
34
|
-
|
31
|
+
['pool_name', _('One of available storage pools')],
|
32
|
+
['capacity', _('String value, eg. 10G')],
|
33
|
+
['format_type', _('Possible values: %s') % 'raw, qcow2']
|
35
34
|
]
|
36
35
|
end
|
37
36
|
|
38
37
|
def interfaces_attrs_name
|
39
|
-
|
38
|
+
'nics_attributes'
|
40
39
|
end
|
41
40
|
|
42
41
|
def mandatory_resource_options
|
43
|
-
super + [
|
42
|
+
super + %i[url]
|
44
43
|
end
|
45
|
-
|
46
44
|
end
|
45
|
+
|
47
46
|
HammerCLIForeman.register_compute_resource('libvirt', Libvirt.new)
|
48
47
|
end
|
49
|
-
end
|
48
|
+
end
|
@@ -2,24 +2,26 @@ module HammerCLIForeman
|
|
2
2
|
module ComputeResources
|
3
3
|
class OpenStack < Base
|
4
4
|
def name
|
5
|
-
|
5
|
+
'OpenStack'
|
6
6
|
end
|
7
7
|
|
8
8
|
def compute_attributes
|
9
|
+
%w[flavor_ref image_ref tenant_id security_groups network]
|
10
|
+
end
|
11
|
+
|
12
|
+
def provider_specific_fields
|
9
13
|
[
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
'security_groups',
|
14
|
-
'network'
|
14
|
+
Fields::Field.new(:label => _('Tenant'), :path => [:tenant]),
|
15
|
+
Fields::Field.new(:label => _('Project domain name'), :path => [:project_domain_name]),
|
16
|
+
Fields::Field.new(:label => _('Project domain ID'), :path => [:project_domain_id])
|
15
17
|
]
|
16
18
|
end
|
17
19
|
|
18
20
|
def mandatory_resource_options
|
19
|
-
super + [
|
21
|
+
super + %i[url user password]
|
20
22
|
end
|
21
|
-
|
22
23
|
end
|
24
|
+
|
23
25
|
HammerCLIForeman.register_compute_resource('openstack', OpenStack.new)
|
24
26
|
end
|
25
|
-
end
|
27
|
+
end
|
@@ -2,46 +2,51 @@ module HammerCLIForeman
|
|
2
2
|
module ComputeResources
|
3
3
|
class Ovirt < Base
|
4
4
|
def name
|
5
|
-
|
5
|
+
'oVirt'
|
6
6
|
end
|
7
7
|
|
8
8
|
def compute_attributes
|
9
9
|
[
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
10
|
+
['cluster', _('ID of cluster to use')],
|
11
|
+
['template', _('Hardware profile to use')],
|
12
|
+
['cores', _('Integer value, number of cores')],
|
13
|
+
['memory', _('Amount of memory, integer value in bytes')]
|
14
14
|
]
|
15
15
|
end
|
16
16
|
|
17
17
|
def host_attributes
|
18
18
|
[
|
19
|
-
|
20
|
-
|
19
|
+
['start', _('Boolean (expressed as 0 or 1), whether to start the machine or not')]
|
21
20
|
]
|
22
21
|
end
|
23
22
|
|
24
23
|
def interface_attributes
|
25
24
|
[
|
26
|
-
|
27
|
-
|
28
|
-
|
25
|
+
['name', _('Compute name, e.g. eth0')],
|
26
|
+
['network', _('Select one of available networks for a cluster, must be an ID')],
|
27
|
+
['interface', _('Interface type')]
|
29
28
|
]
|
30
29
|
end
|
31
30
|
|
32
|
-
def volume_attributes
|
31
|
+
def volume_attributes
|
33
32
|
[
|
34
|
-
|
35
|
-
|
36
|
-
|
33
|
+
['size_gb', _('Volume size in GB, integer value')],
|
34
|
+
['storage_domain', _('ID of storage domain')],
|
35
|
+
['bootable', _('Boolean, only one volume can be bootable')]
|
37
36
|
]
|
38
37
|
end
|
39
38
|
|
40
|
-
def
|
41
|
-
|
39
|
+
def provider_specific_fields
|
40
|
+
[
|
41
|
+
Fields::Field.new(:label => _('Datacenter'), :path => [:datacenter])
|
42
|
+
]
|
42
43
|
end
|
43
44
|
|
45
|
+
def mandatory_resource_options
|
46
|
+
super + %i[url user password datacenter]
|
47
|
+
end
|
44
48
|
end
|
49
|
+
|
45
50
|
HammerCLIForeman.register_compute_resource('ovirt', Ovirt.new)
|
46
51
|
end
|
47
|
-
end
|
52
|
+
end
|