hammer_cli_foreman 0.8.0 → 0.9.0
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of hammer_cli_foreman might be problematic. Click here for more details.
- checksums.yaml +4 -4
- data/config/foreman.yml +1 -0
- data/doc/host_create.md +3 -3
- data/doc/release_notes.md +14 -0
- data/lib/hammer_cli_foreman.rb +0 -1
- data/lib/hammer_cli_foreman/api.rb +3 -0
- data/lib/hammer_cli_foreman/api/connection.rb +75 -0
- data/lib/hammer_cli_foreman/api/interactive_basic_auth.rb +49 -0
- data/lib/hammer_cli_foreman/api/session_authenticator_wrapper.rb +120 -0
- data/lib/hammer_cli_foreman/auth.rb +16 -12
- data/lib/hammer_cli_foreman/commands.rb +4 -36
- data/lib/hammer_cli_foreman/compute_resource.rb +6 -6
- data/lib/hammer_cli_foreman/compute_resources/all.rb +7 -0
- data/lib/hammer_cli_foreman/compute_resources/ec2.rb +9 -0
- data/lib/hammer_cli_foreman/compute_resources/ec2/host_help_extenstion.rb +23 -0
- data/lib/hammer_cli_foreman/compute_resources/gce.rb +9 -0
- data/lib/hammer_cli_foreman/compute_resources/gce/host_help_extenstion.rb +22 -0
- data/lib/hammer_cli_foreman/compute_resources/libvirt.rb +9 -0
- data/lib/hammer_cli_foreman/compute_resources/libvirt/host_help_extenstion.rb +35 -0
- data/lib/hammer_cli_foreman/compute_resources/openstack.rb +9 -0
- data/lib/hammer_cli_foreman/compute_resources/openstack/host_help_extenstion.rb +23 -0
- data/lib/hammer_cli_foreman/compute_resources/ovirt.rb +9 -0
- data/lib/hammer_cli_foreman/compute_resources/ovirt/host_help_extenstion.rb +36 -0
- data/lib/hammer_cli_foreman/compute_resources/rackspace.rb +9 -0
- data/lib/hammer_cli_foreman/compute_resources/rackspace/host_help_extenstion.rb +20 -0
- data/lib/hammer_cli_foreman/compute_resources/vmware.rb +9 -0
- data/lib/hammer_cli_foreman/compute_resources/vmware/host_help_extenstion.rb +62 -0
- data/lib/hammer_cli_foreman/filter.rb +1 -0
- data/lib/hammer_cli_foreman/host.rb +15 -140
- data/lib/hammer_cli_foreman/hosts/common_update_help.rb +53 -0
- data/lib/hammer_cli_foreman/hosts/common_update_options.rb +141 -0
- data/lib/hammer_cli_foreman/references.rb +13 -2
- data/lib/hammer_cli_foreman/role.rb +3 -7
- data/lib/hammer_cli_foreman/smart_class_parameter.rb +2 -2
- data/lib/hammer_cli_foreman/smart_variable.rb +1 -2
- data/lib/hammer_cli_foreman/user.rb +2 -0
- data/lib/hammer_cli_foreman/version.rb +1 -1
- data/locale/ca/LC_MESSAGES/hammer-cli-foreman.mo +0 -0
- data/locale/ca/hammer-cli-foreman.edit.po +520 -318
- data/locale/ca/hammer-cli-foreman.po +253 -175
- data/locale/de/LC_MESSAGES/hammer-cli-foreman.mo +0 -0
- data/locale/de/hammer-cli-foreman.edit.po +568 -358
- data/locale/de/hammer-cli-foreman.po +255 -177
- data/locale/en/LC_MESSAGES/hammer-cli-foreman.mo +0 -0
- data/locale/en/hammer-cli-foreman.edit.po +446 -228
- data/locale/en/hammer-cli-foreman.po +208 -41
- data/locale/en_GB/LC_MESSAGES/hammer-cli-foreman.mo +0 -0
- data/locale/en_GB/hammer-cli-foreman.edit.po +498 -307
- data/locale/en_GB/hammer-cli-foreman.po +254 -176
- data/locale/es/LC_MESSAGES/hammer-cli-foreman.mo +0 -0
- data/locale/es/hammer-cli-foreman.edit.po +594 -388
- data/locale/es/hammer-cli-foreman.po +254 -176
- data/locale/fr/LC_MESSAGES/hammer-cli-foreman.mo +0 -0
- data/locale/fr/hammer-cli-foreman.edit.po +542 -342
- data/locale/fr/hammer-cli-foreman.po +254 -176
- data/locale/hammer-cli-foreman.pot +503 -241
- data/locale/it/LC_MESSAGES/hammer-cli-foreman.mo +0 -0
- data/locale/it/hammer-cli-foreman.edit.po +510 -295
- data/locale/it/hammer-cli-foreman.po +254 -176
- data/locale/ja/LC_MESSAGES/hammer-cli-foreman.mo +0 -0
- data/locale/ja/hammer-cli-foreman.edit.po +590 -365
- data/locale/ja/hammer-cli-foreman.po +254 -176
- data/locale/ko/LC_MESSAGES/hammer-cli-foreman.mo +0 -0
- data/locale/ko/hammer-cli-foreman.edit.po +591 -366
- data/locale/ko/hammer-cli-foreman.po +254 -176
- data/locale/pt_BR/LC_MESSAGES/hammer-cli-foreman.mo +0 -0
- data/locale/pt_BR/hammer-cli-foreman.edit.po +588 -388
- data/locale/pt_BR/hammer-cli-foreman.po +254 -176
- data/locale/ru/LC_MESSAGES/hammer-cli-foreman.mo +0 -0
- data/locale/ru/hammer-cli-foreman.edit.po +549 -336
- data/locale/ru/hammer-cli-foreman.po +254 -176
- data/locale/zh_CN/LC_MESSAGES/hammer-cli-foreman.mo +0 -0
- data/locale/zh_CN/hammer-cli-foreman.edit.po +598 -373
- data/locale/zh_CN/hammer-cli-foreman.po +254 -176
- data/locale/zh_TW/LC_MESSAGES/hammer-cli-foreman.mo +0 -0
- data/locale/zh_TW/hammer-cli-foreman.edit.po +592 -367
- data/locale/zh_TW/hammer-cli-foreman.po +254 -176
- data/test/test_helper.rb +7 -5
- data/test/unit/api/interactive_basic_auth_test.rb +87 -0
- data/test/unit/api/session_authenticator_wrapper_test.rb +263 -0
- data/test/unit/exception_handler_test.rb +1 -1
- data/test/unit/host_test.rb +2 -2
- metadata +314 -292
- data/lib/hammer_cli_foreman/credentials.rb +0 -67
- data/test/unit/credentials_test.rb +0 -59
@@ -0,0 +1,7 @@
|
|
1
|
+
require 'hammer_cli_foreman/compute_resources/ec2'
|
2
|
+
require 'hammer_cli_foreman/compute_resources/gce'
|
3
|
+
require 'hammer_cli_foreman/compute_resources/libvirt'
|
4
|
+
require 'hammer_cli_foreman/compute_resources/openstack'
|
5
|
+
require 'hammer_cli_foreman/compute_resources/ovirt'
|
6
|
+
require 'hammer_cli_foreman/compute_resources/rackspace'
|
7
|
+
require 'hammer_cli_foreman/compute_resources/vmware'
|
@@ -0,0 +1,23 @@
|
|
1
|
+
module HammerCLIForeman
|
2
|
+
module ComputeResources
|
3
|
+
module EC2
|
4
|
+
class HostHelpExtenstion
|
5
|
+
def name
|
6
|
+
_('EC2')
|
7
|
+
end
|
8
|
+
|
9
|
+
def host_create_help(h)
|
10
|
+
h.section '--compute-attributes' do |h|
|
11
|
+
h.list([
|
12
|
+
'flavor_id',
|
13
|
+
'image_id',
|
14
|
+
'availability_zone',
|
15
|
+
'security_group_ids',
|
16
|
+
'managed_ip',
|
17
|
+
])
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
module HammerCLIForeman
|
2
|
+
module ComputeResources
|
3
|
+
module GCE
|
4
|
+
class HostHelpExtenstion
|
5
|
+
def name
|
6
|
+
_('GCE')
|
7
|
+
end
|
8
|
+
|
9
|
+
def host_create_help(h)
|
10
|
+
h.section '--compute-attributes' do |h|
|
11
|
+
h.list([
|
12
|
+
'machine_type',
|
13
|
+
'image_id',
|
14
|
+
'network',
|
15
|
+
'external_ip'
|
16
|
+
])
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
@@ -0,0 +1,35 @@
|
|
1
|
+
module HammerCLIForeman
|
2
|
+
module ComputeResources
|
3
|
+
module Libvirt
|
4
|
+
class HostHelpExtenstion
|
5
|
+
def name
|
6
|
+
_('Libvirt')
|
7
|
+
end
|
8
|
+
|
9
|
+
def host_create_help(h)
|
10
|
+
h.section '--compute-attributes' do |h|
|
11
|
+
h.list([
|
12
|
+
['cpus', _('Number of CPUs')],
|
13
|
+
['memory', _('String, amount of memory, value in bytes')],
|
14
|
+
['start', _('Boolean (expressed as 0 or 1), whether to start the machine or not')]
|
15
|
+
])
|
16
|
+
end
|
17
|
+
h.section '--interface' do |h|
|
18
|
+
h.list([
|
19
|
+
['compute_type', _('Possible values: %s') % 'bridge, network'],
|
20
|
+
['compute_network / compute_bridge', _('Name of interface according to type')],
|
21
|
+
['compute_model', _('Possible values: %s') % 'virtio, rtl8139, ne2k_pci, pcnet, e1000']
|
22
|
+
])
|
23
|
+
end
|
24
|
+
h.section '--volume' do |h|
|
25
|
+
h.list([
|
26
|
+
['pool_name', _('One of available storage pools')],
|
27
|
+
['capacity', _('String value, eg. 10G')],
|
28
|
+
['format_type', _('Possible values: %s') % 'raw, qcow2']
|
29
|
+
])
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
module HammerCLIForeman
|
2
|
+
module ComputeResources
|
3
|
+
module OpenStack
|
4
|
+
class HostHelpExtenstion
|
5
|
+
def name
|
6
|
+
_('OpenStack')
|
7
|
+
end
|
8
|
+
|
9
|
+
def host_create_help(h)
|
10
|
+
h.section '--compute-attributes' do |h|
|
11
|
+
h.list([
|
12
|
+
'flavor_ref',
|
13
|
+
'image_ref',
|
14
|
+
'tenant_id',
|
15
|
+
'security_groups',
|
16
|
+
'network'
|
17
|
+
])
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
@@ -0,0 +1,36 @@
|
|
1
|
+
module HammerCLIForeman
|
2
|
+
module ComputeResources
|
3
|
+
module Ovirt
|
4
|
+
class HostHelpExtenstion
|
5
|
+
def name
|
6
|
+
_('oVirt')
|
7
|
+
end
|
8
|
+
|
9
|
+
def host_create_help(h)
|
10
|
+
h.section '--compute-attributes' do |h|
|
11
|
+
h.list([
|
12
|
+
['cluster'],
|
13
|
+
['template', _('Hardware profile to use')],
|
14
|
+
['cores', _('Integer value, number of cores')],
|
15
|
+
['memory', _('Amount of memory, integer value in bytes')],
|
16
|
+
['start', _('Boolean (expressed as 0 or 1), whether to start the machine or not')]
|
17
|
+
])
|
18
|
+
end
|
19
|
+
h.section '--interface' do |h|
|
20
|
+
h.list([
|
21
|
+
['compute_name', _('Eg. eth0')],
|
22
|
+
['compute_network', _('Select one of available networks for a cluster')]
|
23
|
+
])
|
24
|
+
end
|
25
|
+
h.section '--volume' do |h|
|
26
|
+
h.list([
|
27
|
+
['size_gb', _('Volume size in GB, integer value')],
|
28
|
+
['storage_domain', _('Select one of available storage domains')],
|
29
|
+
['bootable', _('Boolean, only one volume can be bootable')]
|
30
|
+
])
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
module HammerCLIForeman
|
2
|
+
module ComputeResources
|
3
|
+
module Rackspace
|
4
|
+
class HostHelpExtenstion
|
5
|
+
def name
|
6
|
+
_('Rackspace')
|
7
|
+
end
|
8
|
+
|
9
|
+
def host_create_help(h)
|
10
|
+
h.section '--compute-attributes' do |h|
|
11
|
+
h.list([
|
12
|
+
'flavor_id',
|
13
|
+
'image_id'
|
14
|
+
])
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
@@ -0,0 +1,62 @@
|
|
1
|
+
module HammerCLIForeman
|
2
|
+
module ComputeResources
|
3
|
+
module VMware
|
4
|
+
class HostHelpExtenstion
|
5
|
+
INTERFACE_TYPES = %w(
|
6
|
+
VirtualVmxnet,
|
7
|
+
VirtualVmxnet2,
|
8
|
+
VirtualVmxnet3,
|
9
|
+
VirtualE1000,
|
10
|
+
VirtualE1000e,
|
11
|
+
VirtualPCNet32
|
12
|
+
)
|
13
|
+
|
14
|
+
def name
|
15
|
+
_('VMWare')
|
16
|
+
end
|
17
|
+
|
18
|
+
def host_create_help(h)
|
19
|
+
h.section '--compute-attributes' do |h|
|
20
|
+
h.list([
|
21
|
+
['cpus', _("Cpu count")],
|
22
|
+
['corespersocket', _("Number of cores per socket (applicable to hardware versions < 10 only)")],
|
23
|
+
['memory_mb', _("Integer number, amount of memory in MB")],
|
24
|
+
['cluster', _("Cluster id from VMware")],
|
25
|
+
['path', _("Path to folder")],
|
26
|
+
['guest_id', _("Guest OS id form VMware")],
|
27
|
+
['scsi_controller_type', _("Id of the controller from VMware")],
|
28
|
+
['hardware_version', _("Hardware version id from VMware")],
|
29
|
+
['start', _("Must be a 1 or 0, whether to start the machine or not")]
|
30
|
+
])
|
31
|
+
end
|
32
|
+
h.section '--interface' do |h|
|
33
|
+
h.list([
|
34
|
+
['compute_type', interface_type_description(h)],
|
35
|
+
['compute_network', _('Network id from VMware')]
|
36
|
+
])
|
37
|
+
end
|
38
|
+
h.section '--volume' do |h|
|
39
|
+
h.list([
|
40
|
+
['name'],
|
41
|
+
['datastore', _('Datastore id from VMware')],
|
42
|
+
['size_gb', _('Integer number, volume size in GB')],
|
43
|
+
['thin', 'true/false'],
|
44
|
+
['eager_zero', 'true/false']
|
45
|
+
])
|
46
|
+
end
|
47
|
+
end
|
48
|
+
|
49
|
+
private
|
50
|
+
|
51
|
+
def interface_type_description(h)
|
52
|
+
[
|
53
|
+
_('Type of the network adapter, for example one of:'),
|
54
|
+
h.indent(INTERFACE_TYPES),
|
55
|
+
_("See documentation center for your version of vSphere to find more details about available adapter types:"),
|
56
|
+
h.indent("https://www.vmware.com/support/pubs/")
|
57
|
+
].join("\n")
|
58
|
+
end
|
59
|
+
end
|
60
|
+
end
|
61
|
+
end
|
62
|
+
end
|
@@ -10,6 +10,7 @@ module HammerCLIForeman
|
|
10
10
|
field :resource_type, _("Resource type")
|
11
11
|
field :search, _("Search")
|
12
12
|
field :unlimited?, _("Unlimited?"), Fields::Boolean
|
13
|
+
field :override?, _("Override?"), Fields::Boolean
|
13
14
|
field :role, _("Role"), Fields::Reference
|
14
15
|
field :permissions, _("Permissions"), Fields::List
|
15
16
|
end
|
@@ -4,155 +4,26 @@ require 'hammer_cli_foreman/puppet_class'
|
|
4
4
|
require 'hammer_cli_foreman/smart_class_parameter'
|
5
5
|
require 'hammer_cli_foreman/smart_variable'
|
6
6
|
require 'hammer_cli_foreman/interface'
|
7
|
+
require 'hammer_cli_foreman/hosts/common_update_options'
|
8
|
+
require 'hammer_cli_foreman/hosts/common_update_help'
|
7
9
|
|
8
10
|
require 'highline/import'
|
9
11
|
|
10
12
|
module HammerCLIForeman
|
11
13
|
|
12
|
-
module CommonHostUpdateOptions
|
13
|
-
|
14
|
-
def self.included(base)
|
15
|
-
base.option "--owner", "OWNER_LOGIN", _("Login of the owner"),
|
16
|
-
:attribute_name => :option_user_login
|
17
|
-
base.option "--owner-id", "OWNER_ID", _("ID of the owner"),
|
18
|
-
:attribute_name => :option_user_id
|
19
|
-
|
20
|
-
base.option "--root-password", "ROOT_PW", " "
|
21
|
-
base.option "--ask-root-password", "ASK_ROOT_PW", " ",
|
22
|
-
:format => HammerCLI::Options::Normalizers::Bool.new
|
23
|
-
|
24
|
-
base.option "--puppet-proxy", "PUPPET_PROXY_NAME", ""
|
25
|
-
base.option "--puppet-ca-proxy", "PUPPET_CA_PROXY_NAME", ""
|
26
|
-
base.option "--puppet-class-ids", "PUPPET_CLASS_IDS", "",
|
27
|
-
:format => HammerCLI::Options::Normalizers::List.new,
|
28
|
-
:attribute_name => :option_puppetclass_ids
|
29
|
-
base.option "--puppet-classes", "PUPPET_CLASS_NAMES", "",
|
30
|
-
:format => HammerCLI::Options::Normalizers::List.new
|
31
|
-
|
32
|
-
bme_options = {}
|
33
|
-
bme_options[:default] = 'true' if base.action.to_sym == :create
|
34
|
-
|
35
|
-
bme_options[:format] = HammerCLI::Options::Normalizers::Bool.new
|
36
|
-
base.option "--managed", "MANAGED", " ", bme_options
|
37
|
-
bme_options[:format] = HammerCLI::Options::Normalizers::Bool.new
|
38
|
-
base.option "--build", "BUILD", " ", bme_options
|
39
|
-
bme_options[:format] = HammerCLI::Options::Normalizers::Bool.new
|
40
|
-
base.option "--enabled", "ENABLED", " ", bme_options
|
41
|
-
bme_options[:format] = HammerCLI::Options::Normalizers::Bool.new
|
42
|
-
base.option "--overwrite", "OVERWRITE", " ", bme_options
|
43
|
-
|
44
|
-
base.option "--parameters", "PARAMS", _("Host parameters."),
|
45
|
-
:format => HammerCLI::Options::Normalizers::KeyValueList.new
|
46
|
-
base.option "--compute-attributes", "COMPUTE_ATTRS", _("Compute resource attributes."),
|
47
|
-
:format => HammerCLI::Options::Normalizers::KeyValueList.new
|
48
|
-
base.option "--volume", "VOLUME", _("Volume parameters"), :multivalued => true,
|
49
|
-
:format => HammerCLI::Options::Normalizers::KeyValueList.new
|
50
|
-
base.option "--interface", "INTERFACE", _("Interface parameters."), :multivalued => true,
|
51
|
-
:format => HammerCLI::Options::Normalizers::KeyValueList.new
|
52
|
-
base.option "--provision-method", "METHOD", " ",
|
53
|
-
:format => HammerCLI::Options::Normalizers::Enum.new(['build', 'image'])
|
54
|
-
|
55
|
-
base.build_options :without => [
|
56
|
-
# - temporarily disabled params that will be removed from the api ------------------
|
57
|
-
:provision_method, :capabilities, :flavour_ref, :image_ref, :start,
|
58
|
-
:network, :cpus, :memory, :provider, :type, :tenant_id, :image_id,
|
59
|
-
# ----------------------------------------------------------------------------------
|
60
|
-
:puppet_class_ids, :host_parameters_attributes, :interfaces_attributes]
|
61
|
-
end
|
62
|
-
|
63
|
-
def self.ask_password
|
64
|
-
prompt = _("Enter the root password for the host:") + " "
|
65
|
-
ask(prompt) {|q| q.echo = false}
|
66
|
-
end
|
67
|
-
|
68
|
-
def request_params
|
69
|
-
params = super
|
70
|
-
|
71
|
-
owner_id = get_resource_id(HammerCLIForeman.foreman_resource(:users), :required => false, :scoped => true)
|
72
|
-
params['host']['owner_id'] ||= owner_id unless owner_id.nil?
|
73
|
-
|
74
|
-
puppet_proxy_id = proxy_id(option_puppet_proxy)
|
75
|
-
params['host']['puppet_proxy_id'] ||= puppet_proxy_id unless puppet_proxy_id.nil?
|
76
|
-
|
77
|
-
puppet_ca_proxy_id = proxy_id(option_puppet_ca_proxy)
|
78
|
-
params['host']['puppet_ca_proxy_id'] ||= puppet_ca_proxy_id unless puppet_ca_proxy_id.nil?
|
79
|
-
|
80
|
-
puppetclass_ids = option_puppetclass_ids || puppet_class_ids(option_puppet_classes)
|
81
|
-
params['host']['puppetclass_ids'] = puppetclass_ids unless puppetclass_ids.nil?
|
82
|
-
|
83
|
-
params['host']['build'] = option_build unless option_build.nil?
|
84
|
-
params['host']['managed'] = option_managed unless option_managed.nil?
|
85
|
-
params['host']['enabled'] = option_enabled unless option_enabled.nil?
|
86
|
-
params['host']['overwrite'] = option_overwrite unless option_overwrite.nil?
|
87
|
-
|
88
|
-
params['host']['host_parameters_attributes'] = parameter_attributes
|
89
|
-
params['host']['compute_attributes'] = option_compute_attributes || {}
|
90
|
-
params['host']['compute_attributes']['volumes_attributes'] = nested_attributes(option_volume_list)
|
91
|
-
params['host']['interfaces_attributes'] = interfaces_attributes
|
92
|
-
|
93
|
-
params['host']['root_pass'] = option_root_password unless option_root_password.nil?
|
94
14
|
|
95
|
-
|
96
|
-
params['host']['root_pass'] = HammerCLIForeman::CommonHostUpdateOptions::ask_password
|
97
|
-
end
|
98
|
-
|
99
|
-
params
|
100
|
-
end
|
101
|
-
|
102
|
-
private
|
103
|
-
|
104
|
-
def proxy_id(name)
|
105
|
-
resolver.smart_proxy_id('option_name' => name) if name
|
106
|
-
end
|
107
|
-
|
108
|
-
def puppet_class_ids(names)
|
109
|
-
resolver.puppetclass_ids('option_names' => names) if names
|
110
|
-
end
|
111
|
-
|
112
|
-
def parameter_attributes
|
113
|
-
return {} unless option_parameters
|
114
|
-
option_parameters.collect do |key, value|
|
115
|
-
if value.is_a? String
|
116
|
-
{"name"=>key, "value"=>value}
|
117
|
-
else
|
118
|
-
{"name"=>key, "value"=>value.inspect}
|
119
|
-
end
|
120
|
-
end
|
121
|
-
end
|
15
|
+
class Host < HammerCLIForeman::Command
|
122
16
|
|
123
|
-
|
124
|
-
return {} unless attrs
|
17
|
+
resource :hosts
|
125
18
|
|
126
|
-
|
127
|
-
|
128
|
-
nested_hash[i.to_s] = attr
|
129
|
-
end
|
130
|
-
nested_hash
|
19
|
+
def self.extend_cr_help(cr)
|
20
|
+
cr_help_extensions[cr.name] = cr.method(:host_create_help)
|
131
21
|
end
|
132
22
|
|
133
|
-
def
|
134
|
-
|
135
|
-
|
136
|
-
# move each attribute starting with "compute_" to compute_attributes
|
137
|
-
option_interface_list.collect do |nic|
|
138
|
-
compute_attributes = {}
|
139
|
-
nic.keys.each do |key|
|
140
|
-
if key.start_with? 'compute_'
|
141
|
-
compute_attributes[key.gsub('compute_', '')] = nic.delete(key)
|
142
|
-
end
|
143
|
-
end
|
144
|
-
nic['compute_attributes'] = compute_attributes unless compute_attributes.empty?
|
145
|
-
nic
|
146
|
-
end
|
23
|
+
def self.cr_help_extensions
|
24
|
+
@cr_help_extensions ||= {}
|
147
25
|
end
|
148
26
|
|
149
|
-
end
|
150
|
-
|
151
|
-
|
152
|
-
class Host < HammerCLIForeman::Command
|
153
|
-
|
154
|
-
resource :hosts
|
155
|
-
|
156
27
|
class ListCommand < HammerCLIForeman::ListCommand
|
157
28
|
# FIXME: list compute resource (model)
|
158
29
|
output do
|
@@ -357,7 +228,8 @@ module HammerCLIForeman
|
|
357
228
|
success_message _("Host created")
|
358
229
|
failure_message _("Could not create the host")
|
359
230
|
|
360
|
-
include HammerCLIForeman::
|
231
|
+
include HammerCLIForeman::Hosts::CommonUpdateOptions
|
232
|
+
include HammerCLIForeman::Hosts::CommonUpdateHelp
|
361
233
|
|
362
234
|
def validate_options
|
363
235
|
super
|
@@ -368,14 +240,15 @@ module HammerCLIForeman
|
|
368
240
|
end
|
369
241
|
end
|
370
242
|
end
|
371
|
-
end
|
372
243
|
|
244
|
+
end
|
373
245
|
|
374
246
|
class UpdateCommand < HammerCLIForeman::UpdateCommand
|
375
247
|
success_message _("Host updated")
|
376
248
|
failure_message _("Could not update the host")
|
377
249
|
|
378
|
-
include HammerCLIForeman::
|
250
|
+
include HammerCLIForeman::Hosts::CommonUpdateOptions
|
251
|
+
include HammerCLIForeman::Hosts::CommonUpdateHelp
|
379
252
|
end
|
380
253
|
|
381
254
|
|
@@ -524,3 +397,5 @@ module HammerCLIForeman
|
|
524
397
|
end
|
525
398
|
|
526
399
|
end
|
400
|
+
|
401
|
+
require 'hammer_cli_foreman/compute_resources/all'
|