hammer_cli_foreman 0.16.0 → 0.17.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 +5 -5
- data/doc/release_notes.md +13 -0
- data/lib/hammer_cli_foreman.rb +4 -0
- data/lib/hammer_cli_foreman/common_parameter.rb +4 -0
- data/lib/hammer_cli_foreman/compute_attribute.rb +318 -0
- data/lib/hammer_cli_foreman/compute_profile.rb +61 -0
- data/lib/hammer_cli_foreman/compute_resource.rb +29 -13
- data/lib/hammer_cli_foreman/compute_resource/base.rb +12 -0
- data/lib/hammer_cli_foreman/compute_resource/ec2.rb +24 -0
- data/lib/hammer_cli_foreman/compute_resource/gce.rb +23 -0
- data/lib/hammer_cli_foreman/compute_resource/help_utils.rb +34 -0
- data/lib/hammer_cli_foreman/compute_resource/libvirt.rb +49 -0
- data/lib/hammer_cli_foreman/compute_resource/openstack.rb +25 -0
- data/lib/hammer_cli_foreman/compute_resource/ovirt.rb +47 -0
- data/lib/hammer_cli_foreman/compute_resource/rackspace.rb +22 -0
- data/lib/hammer_cli_foreman/compute_resource/register_compute_resources.rb +20 -0
- data/lib/hammer_cli_foreman/compute_resource/vmware.rb +68 -0
- data/lib/hammer_cli_foreman/host.rb +4 -11
- data/lib/hammer_cli_foreman/hostgroup.rb +9 -0
- data/lib/hammer_cli_foreman/hosts/common_update_help.rb +1 -7
- data/lib/hammer_cli_foreman/hosts/common_update_options.rb +1 -1
- data/lib/hammer_cli_foreman/id_resolver.rb +3 -1
- data/lib/hammer_cli_foreman/parameter.rb +7 -0
- data/lib/hammer_cli_foreman/references.rb +8 -0
- data/lib/hammer_cli_foreman/report_template.rb +79 -0
- data/lib/hammer_cli_foreman/smart_variable.rb +1 -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.21/foreman_api.json +1 -0
- data/test/data/1.22/foreman_api.json +1 -0
- data/test/functional/compute_attribute_test.rb +654 -0
- data/test/functional/compute_profile_test.rb +99 -0
- data/test/functional/compute_resource_test.rb +42 -18
- data/test/functional/location_test.rb +6 -5
- data/test/functional/organization_test.rb +6 -5
- data/test/functional/report_template_test.rb +107 -7
- data/test/test_helper.rb +1 -1
- data/test/unit/common_parameter_test.rb +17 -5
- data/test/unit/domain_test.rb +2 -0
- data/test/unit/host_test.rb +1 -0
- data/test/unit/hostgroup_test.rb +14 -1
- data/test/unit/operating_system_test.rb +1 -0
- metadata +25 -20
- data/lib/hammer_cli_foreman/compute_resources/all.rb +0 -7
- data/lib/hammer_cli_foreman/compute_resources/ec2.rb +0 -9
- data/lib/hammer_cli_foreman/compute_resources/ec2/host_help_extenstion.rb +0 -23
- data/lib/hammer_cli_foreman/compute_resources/gce.rb +0 -9
- data/lib/hammer_cli_foreman/compute_resources/gce/host_help_extenstion.rb +0 -22
- data/lib/hammer_cli_foreman/compute_resources/libvirt.rb +0 -9
- data/lib/hammer_cli_foreman/compute_resources/libvirt/host_help_extenstion.rb +0 -35
- data/lib/hammer_cli_foreman/compute_resources/openstack.rb +0 -9
- data/lib/hammer_cli_foreman/compute_resources/openstack/host_help_extenstion.rb +0 -23
- data/lib/hammer_cli_foreman/compute_resources/ovirt.rb +0 -9
- data/lib/hammer_cli_foreman/compute_resources/ovirt/host_help_extenstion.rb +0 -36
- data/lib/hammer_cli_foreman/compute_resources/rackspace.rb +0 -9
- data/lib/hammer_cli_foreman/compute_resources/rackspace/host_help_extenstion.rb +0 -20
- data/lib/hammer_cli_foreman/compute_resources/vmware.rb +0 -9
- data/lib/hammer_cli_foreman/compute_resources/vmware/host_help_extenstion.rb +0 -66
@@ -0,0 +1,12 @@
|
|
1
|
+
module HammerCLIForeman
|
2
|
+
module ComputeResources
|
3
|
+
class Base
|
4
|
+
attr_reader :name
|
5
|
+
def compute_attributes; []; end
|
6
|
+
def interface_attributes; []; end
|
7
|
+
def volume_attributes; []; end
|
8
|
+
def interfaces_attrs_name; "interfaces_attributes" ; end
|
9
|
+
def mandatory_resource_options; [:name, :provider]; end
|
10
|
+
end
|
11
|
+
end
|
12
|
+
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
module HammerCLIForeman
|
2
|
+
module ComputeResources
|
3
|
+
class EC2 < Base
|
4
|
+
def name
|
5
|
+
_('EC2')
|
6
|
+
end
|
7
|
+
|
8
|
+
def compute_attributes
|
9
|
+
[
|
10
|
+
'flavor_id',
|
11
|
+
'image_id',
|
12
|
+
'availability_zone',
|
13
|
+
'security_group_ids',
|
14
|
+
'managed_ip'
|
15
|
+
]
|
16
|
+
end
|
17
|
+
|
18
|
+
def mandatory_resource_options
|
19
|
+
super + [:region, :user, :password]
|
20
|
+
end
|
21
|
+
end
|
22
|
+
HammerCLIForeman.register_compute_resource('ec2', EC2.new )
|
23
|
+
end
|
24
|
+
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
module HammerCLIForeman
|
2
|
+
module ComputeResources
|
3
|
+
class GCE < Base
|
4
|
+
def name
|
5
|
+
_('GCE')
|
6
|
+
end
|
7
|
+
|
8
|
+
def compute_attributes
|
9
|
+
[
|
10
|
+
'machine_type',
|
11
|
+
'image_id',
|
12
|
+
'network',
|
13
|
+
'external_ip'
|
14
|
+
]
|
15
|
+
end
|
16
|
+
|
17
|
+
def interfaces_attrs_name
|
18
|
+
"network_interfaces_nics_attributes"
|
19
|
+
end
|
20
|
+
end
|
21
|
+
HammerCLIForeman.register_compute_resource('gce', GCE.new)
|
22
|
+
end
|
23
|
+
end
|
@@ -0,0 +1,34 @@
|
|
1
|
+
module HammerCLIForeman
|
2
|
+
module ComputeResources
|
3
|
+
def self.extend_help(h, attributes, add_host_specific_attrs: false )
|
4
|
+
h.section _('Provider specific options') do |h|
|
5
|
+
::HammerCLIForeman.compute_resources.each do |name, provider|
|
6
|
+
h.section name do |h|
|
7
|
+
if add_host_specific_attrs and defined?(provider.host_attributes) and defined?(provider.interface_attributes)
|
8
|
+
host_interfaces = provider.interface_attributes + provider.host_attributes
|
9
|
+
end
|
10
|
+
if attributes == :all || attributes == :volume
|
11
|
+
h.section '--volume' do |h|
|
12
|
+
h.list(provider.volume_attributes) if defined?(provider.volume_attributes)
|
13
|
+
end
|
14
|
+
end
|
15
|
+
if attributes == :all || attributes == :interface
|
16
|
+
h.section '--interface' do |h|
|
17
|
+
if host_interfaces
|
18
|
+
h.list(host_interfaces)
|
19
|
+
else
|
20
|
+
h.list(provider.interface_attributes) if defined?(provider.interface_attributes)
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
if attributes == :all || attributes == :compute
|
25
|
+
h.section '--compute-attributes' do |h|
|
26
|
+
h.list(provider.compute_attributes) if defined?(provider.compute_attributes)
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
@@ -0,0 +1,49 @@
|
|
1
|
+
module HammerCLIForeman
|
2
|
+
module ComputeResources
|
3
|
+
class Libvirt < Base
|
4
|
+
def name
|
5
|
+
_('Libvirt')
|
6
|
+
end
|
7
|
+
|
8
|
+
def compute_attributes
|
9
|
+
[
|
10
|
+
['cpus', _('Number of CPUs')],
|
11
|
+
['memory', _('String, amount of memory, value in bytes')],
|
12
|
+
['start', _('Boolean (expressed as 0 or 1), whether to start the machine or not')]
|
13
|
+
]
|
14
|
+
end
|
15
|
+
|
16
|
+
def host_attributes
|
17
|
+
[
|
18
|
+
['start', _('Boolean (expressed as 0 or 1), whether to start the machine or not')]
|
19
|
+
]
|
20
|
+
end
|
21
|
+
|
22
|
+
def interface_attributes
|
23
|
+
[
|
24
|
+
['type', _('Possible values: %s') % 'bridge, network'],
|
25
|
+
['bridge', _('Name of interface according to type')],
|
26
|
+
['model', _('Possible values: %s') % 'virtio, rtl8139, ne2k_pci, pcnet, e1000']
|
27
|
+
]
|
28
|
+
end
|
29
|
+
|
30
|
+
def volume_attributes
|
31
|
+
[
|
32
|
+
['pool_name', _('One of available storage pools')],
|
33
|
+
['capacity', _('String value, eg. 10G')],
|
34
|
+
['format_type', _('Possible values: %s') % 'raw, qcow2']
|
35
|
+
]
|
36
|
+
end
|
37
|
+
|
38
|
+
def interfaces_attrs_name
|
39
|
+
"nics_attributes"
|
40
|
+
end
|
41
|
+
|
42
|
+
def mandatory_resource_options
|
43
|
+
super + [:url]
|
44
|
+
end
|
45
|
+
|
46
|
+
end
|
47
|
+
HammerCLIForeman.register_compute_resource('libvirt', Libvirt.new)
|
48
|
+
end
|
49
|
+
end
|
@@ -0,0 +1,25 @@
|
|
1
|
+
module HammerCLIForeman
|
2
|
+
module ComputeResources
|
3
|
+
class OpenStack < Base
|
4
|
+
def name
|
5
|
+
_('OpenStack')
|
6
|
+
end
|
7
|
+
|
8
|
+
def compute_attributes
|
9
|
+
[
|
10
|
+
'flavor_ref',
|
11
|
+
'image_ref',
|
12
|
+
'tenant_id',
|
13
|
+
'security_groups',
|
14
|
+
'network'
|
15
|
+
]
|
16
|
+
end
|
17
|
+
|
18
|
+
def mandatory_resource_options
|
19
|
+
super + [:url, :user, :password]
|
20
|
+
end
|
21
|
+
|
22
|
+
end
|
23
|
+
HammerCLIForeman.register_compute_resource('openstack', OpenStack.new)
|
24
|
+
end
|
25
|
+
end
|
@@ -0,0 +1,47 @@
|
|
1
|
+
module HammerCLIForeman
|
2
|
+
module ComputeResources
|
3
|
+
class Ovirt < Base
|
4
|
+
def name
|
5
|
+
_('oVirt')
|
6
|
+
end
|
7
|
+
|
8
|
+
def compute_attributes
|
9
|
+
[
|
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
|
+
]
|
15
|
+
end
|
16
|
+
|
17
|
+
def host_attributes
|
18
|
+
[
|
19
|
+
['start', _('Boolean (expressed as 0 or 1), whether to start the machine or not')]
|
20
|
+
|
21
|
+
]
|
22
|
+
end
|
23
|
+
|
24
|
+
def interface_attributes
|
25
|
+
[
|
26
|
+
['name', _('compute name, Eg. eth0')],
|
27
|
+
['network', _('Select one of available networks for a cluster, must be an ID')],
|
28
|
+
['interface', ('interface type')]
|
29
|
+
]
|
30
|
+
end
|
31
|
+
|
32
|
+
def volume_attributes;
|
33
|
+
[
|
34
|
+
['size_gb', _('Volume size in GB, integer value')],
|
35
|
+
['storage_domain', _('ID of storage domain')],
|
36
|
+
['bootable', _('Boolean, only one volume can be bootable')]
|
37
|
+
]
|
38
|
+
end
|
39
|
+
|
40
|
+
def mandatory_resource_options
|
41
|
+
super + [:url, :user, :password, :datacenter]
|
42
|
+
end
|
43
|
+
|
44
|
+
end
|
45
|
+
HammerCLIForeman.register_compute_resource('ovirt', Ovirt.new)
|
46
|
+
end
|
47
|
+
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
module HammerCLIForeman
|
2
|
+
module ComputeResources
|
3
|
+
class Rackspace < Base
|
4
|
+
def name
|
5
|
+
_('Rackspace')
|
6
|
+
end
|
7
|
+
|
8
|
+
def compute_attributes
|
9
|
+
[
|
10
|
+
'flavor_id',
|
11
|
+
'image_id'
|
12
|
+
]
|
13
|
+
end
|
14
|
+
|
15
|
+
def mandatory_resource_options
|
16
|
+
super + [:url]
|
17
|
+
end
|
18
|
+
|
19
|
+
end
|
20
|
+
HammerCLIForeman.register_compute_resource('rackspace', Rackspace.new)
|
21
|
+
end
|
22
|
+
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
module HammerCLIForeman
|
2
|
+
@compute_resources = {}
|
3
|
+
def self.compute_resources
|
4
|
+
@compute_resources
|
5
|
+
end
|
6
|
+
|
7
|
+
def self.register_compute_resource(name, compute_resource)
|
8
|
+
@compute_resources[name] = compute_resource
|
9
|
+
end
|
10
|
+
|
11
|
+
|
12
|
+
require 'hammer_cli_foreman/compute_resource/base'
|
13
|
+
require 'hammer_cli_foreman/compute_resource/ec2.rb'
|
14
|
+
require 'hammer_cli_foreman/compute_resource/gce.rb'
|
15
|
+
require 'hammer_cli_foreman/compute_resource/libvirt.rb'
|
16
|
+
require 'hammer_cli_foreman/compute_resource/openstack.rb'
|
17
|
+
require 'hammer_cli_foreman/compute_resource/ovirt.rb'
|
18
|
+
require 'hammer_cli_foreman/compute_resource/rackspace.rb'
|
19
|
+
require 'hammer_cli_foreman/compute_resource/vmware.rb'
|
20
|
+
end
|
@@ -0,0 +1,68 @@
|
|
1
|
+
module HammerCLIForeman
|
2
|
+
module ComputeResources
|
3
|
+
class VMware < Base
|
4
|
+
INTERFACE_TYPES = %w(
|
5
|
+
VirtualVmxnet3,
|
6
|
+
VirtualE1000
|
7
|
+
)
|
8
|
+
|
9
|
+
def name
|
10
|
+
_('VMware')
|
11
|
+
end
|
12
|
+
|
13
|
+
def compute_attributes
|
14
|
+
[
|
15
|
+
['cpus', _('CPU count')],
|
16
|
+
['corespersocket', _('Number of cores per socket (applicable to hardware versions < 10 only)')],
|
17
|
+
['memory_mb', _('Integer number, amount of memory in MB')],
|
18
|
+
['firmware', 'automatic/bios/efi'],
|
19
|
+
['cluster', _('Cluster ID from VMware')],
|
20
|
+
['resource_pool', _('Resource Pool ID from VMware')],
|
21
|
+
['path', _('Path to folder')],
|
22
|
+
['guest_id', _('Guest OS ID form VMware')],
|
23
|
+
['scsi_controller_type', _('ID of the controller from VMware')],
|
24
|
+
['hardware_version', _('Hardware version ID from VMware')],
|
25
|
+
['add_cdrom', _('Must be a 1 or 0, Add a CD-ROM drive to the virtual machine')],
|
26
|
+
['cpuHotAddEnabled', _('Must be a 1 or 0, lets you add memory resources while the machine is on')],
|
27
|
+
['memoryHotAddEnabled', _('Must be a 1 or 0, lets you add CPU resources while the machine is on')],
|
28
|
+
['annotation', _("Annotation Notes")]
|
29
|
+
]
|
30
|
+
end
|
31
|
+
|
32
|
+
def host_attributes
|
33
|
+
[
|
34
|
+
['start', _("Must be a 1 or 0, whether to start the machine or not")],
|
35
|
+
]
|
36
|
+
end
|
37
|
+
|
38
|
+
def interface_attributes
|
39
|
+
[
|
40
|
+
['compute_type', [
|
41
|
+
_('Type of the network adapter, for example one of:'),
|
42
|
+
INTERFACE_TYPES.map { |it| ' ' + it },
|
43
|
+
_('See documentation center for your version of vSphere to find more details about available adapter types:'),
|
44
|
+
' https://www.vmware.com/support/pubs/'].flatten(1).join("\n") ] ,
|
45
|
+
['compute_network', _('Network ID from VMware')]
|
46
|
+
]
|
47
|
+
end
|
48
|
+
|
49
|
+
def volume_attributes;
|
50
|
+
[
|
51
|
+
['name'],
|
52
|
+
['storage_pod', _('Storage Pod ID from VMware')],
|
53
|
+
['datastore', _('Datastore ID from VMware')],
|
54
|
+
['size_gb', _('Integer number, volume size in GB')],
|
55
|
+
['thin', 'true/false'],
|
56
|
+
['eager_zero', 'true/false'],
|
57
|
+
['mode', 'persistent/independent_persistent/independent_nonpersistent']
|
58
|
+
]
|
59
|
+
end
|
60
|
+
|
61
|
+
def mandatory_resource_options
|
62
|
+
super + [:user, :password, :datacenter, :server]
|
63
|
+
|
64
|
+
end
|
65
|
+
end
|
66
|
+
HammerCLIForeman.register_compute_resource('vmware', VMware.new)
|
67
|
+
end
|
68
|
+
end
|
@@ -6,6 +6,8 @@ require 'hammer_cli_foreman/smart_variable'
|
|
6
6
|
require 'hammer_cli_foreman/interface'
|
7
7
|
require 'hammer_cli_foreman/hosts/common_update_options'
|
8
8
|
require 'hammer_cli_foreman/hosts/common_update_help'
|
9
|
+
require 'hammer_cli_foreman/compute_resource/register_compute_resources'
|
10
|
+
require 'hammer_cli_foreman/compute_resource/help_utils'
|
9
11
|
|
10
12
|
require 'highline/import'
|
11
13
|
|
@@ -16,14 +18,6 @@ module HammerCLIForeman
|
|
16
18
|
|
17
19
|
resource :hosts
|
18
20
|
|
19
|
-
def self.extend_cr_help(cr)
|
20
|
-
cr_help_extensions[cr.name] = cr.method(:host_create_help)
|
21
|
-
end
|
22
|
-
|
23
|
-
def self.cr_help_extensions
|
24
|
-
@cr_help_extensions ||= {}
|
25
|
-
end
|
26
|
-
|
27
21
|
class ListCommand < HammerCLIForeman::ListCommand
|
28
22
|
# FIXME: list compute resource (model)
|
29
23
|
output do
|
@@ -70,6 +64,7 @@ module HammerCLIForeman
|
|
70
64
|
|
71
65
|
field :installed_at, _("Installed at"), Fields::Date
|
72
66
|
field :last_report, _("Last report"), Fields::Date
|
67
|
+
field :uptime_seconds, _("Uptime (seconds)"), Fields::Field, :hide_blank => true
|
73
68
|
|
74
69
|
label _("Status") do
|
75
70
|
field :global_status_label, _("Global Status")
|
@@ -325,7 +320,7 @@ module HammerCLIForeman
|
|
325
320
|
|
326
321
|
|
327
322
|
class SetParameterCommand < HammerCLIForeman::Parameter::SetCommand
|
328
|
-
desc _("Create or
|
323
|
+
desc _("Create or append a parameter for a host")
|
329
324
|
|
330
325
|
success_message_for :update, _("Host parameter updated")
|
331
326
|
success_message_for :create, _("New host parameter created")
|
@@ -521,5 +516,3 @@ module HammerCLIForeman
|
|
521
516
|
subcommand 'interface', HammerCLIForeman::Interface.desc, HammerCLIForeman::Interface
|
522
517
|
end
|
523
518
|
end
|
524
|
-
|
525
|
-
require 'hammer_cli_foreman/compute_resources/all'
|
@@ -190,6 +190,15 @@ module HammerCLIForeman
|
|
190
190
|
end
|
191
191
|
end
|
192
192
|
|
193
|
+
class RebuildConfigCommand < HammerCLIForeman::SingleResourceCommand
|
194
|
+
action :rebuild_config
|
195
|
+
command_name "rebuild-config"
|
196
|
+
success_message _('Configuration successfully rebuilt.')
|
197
|
+
failure_message _('Could not rebuild configuration')
|
198
|
+
|
199
|
+
build_options
|
200
|
+
end
|
201
|
+
|
193
202
|
autoload_subcommands
|
194
203
|
end
|
195
204
|
|
@@ -39,13 +39,7 @@ module HammerCLIForeman
|
|
39
39
|
end
|
40
40
|
end
|
41
41
|
|
42
|
-
|
43
|
-
HammerCLIForeman::Host.cr_help_extensions.each do |name, help|
|
44
|
-
h.section name do |h|
|
45
|
-
help.call(h)
|
46
|
-
end
|
47
|
-
end
|
48
|
-
end
|
42
|
+
::HammerCLIForeman::ComputeResources.extend_help(h, :all, add_host_specific_attrs: true )
|
49
43
|
end
|
50
44
|
end
|
51
45
|
end
|
@@ -28,7 +28,7 @@ module HammerCLIForeman
|
|
28
28
|
bme_options[:format] = HammerCLI::Options::Normalizers::Bool.new
|
29
29
|
base.option "--overwrite", "OVERWRITE", " ", bme_options
|
30
30
|
|
31
|
-
base.option "--parameters", "PARAMS", _("
|
31
|
+
base.option "--parameters", "PARAMS", _("Replaces with new host parameters"),
|
32
32
|
:format => HammerCLI::Options::Normalizers::KeyValueList.new
|
33
33
|
base.option "--compute-attributes", "COMPUTE_ATTRS", _("Compute resource attributes"),
|
34
34
|
:format => HammerCLI::Options::Normalizers::KeyValueList.new
|
@@ -36,6 +36,7 @@ module HammerCLIForeman
|
|
36
36
|
:architecture => [ s_name(_("Architecture name")) ],
|
37
37
|
:audit => [],
|
38
38
|
:compute_resource => [ s_name(_("Compute resource name")) ],
|
39
|
+
:compute_profile => [ s_name(_("Compute profile name")) ],
|
39
40
|
:domain => [ s_name(_("Domain name")) ],
|
40
41
|
:environment => [ s_name(_("Environment name")) ],
|
41
42
|
:fact_value => [],
|
@@ -62,7 +63,8 @@ module HammerCLIForeman
|
|
62
63
|
:common_parameter => [ s_name(_("Common parameter name")) ],
|
63
64
|
:smart_class_parameter => [ s_name(_("Smart class parameter name"), :editable => false) ],
|
64
65
|
:smart_variable => [ s("variable", _("Smart variable name")) ],
|
65
|
-
:template_combination => []
|
66
|
+
:template_combination => [],
|
67
|
+
:compute_attribute => []
|
66
68
|
}
|
67
69
|
DEFAULT_SEARCHABLES = [ s_name(_("Name to search by")) ]
|
68
70
|
|
@@ -4,6 +4,8 @@ module HammerCLIForeman
|
|
4
4
|
|
5
5
|
module Parameter
|
6
6
|
|
7
|
+
KEY_TYPES = ['string', 'boolean', 'integer', 'real', 'array', 'hash', 'yaml', 'json']
|
8
|
+
|
7
9
|
class AbstractParameterCommand < HammerCLIForeman::Command
|
8
10
|
|
9
11
|
def self.parameter_resource
|
@@ -48,6 +50,9 @@ module HammerCLIForeman
|
|
48
50
|
class SetCommand < AbstractParameterCommand
|
49
51
|
option "--name", "NAME", _("Parameter name"), :required => true
|
50
52
|
option "--value", "VALUE", _("Parameter value"), :required => true
|
53
|
+
option "--parameter-type", "PARAMETER_TYPE", _("Type of the parameter"),
|
54
|
+
:default => 'string',
|
55
|
+
:format => HammerCLI::Options::Normalizers::Enum.new(Parameter::KEY_TYPES)
|
51
56
|
option "--hidden-value", "HIDDEN_VALUE", _("Should the value be hidden"), :format => HammerCLI::Options::Normalizers::Bool.new
|
52
57
|
|
53
58
|
def self.command_name(name=nil)
|
@@ -74,6 +79,7 @@ module HammerCLIForeman
|
|
74
79
|
"id" => get_parameter_identifier,
|
75
80
|
"parameter" => {
|
76
81
|
"value" => option_value,
|
82
|
+
"parameter_type" => option_parameter_type,
|
77
83
|
"hidden_value" => option_hidden_value
|
78
84
|
}
|
79
85
|
}.merge(base_action_params)
|
@@ -85,6 +91,7 @@ module HammerCLIForeman
|
|
85
91
|
"parameter" => {
|
86
92
|
"name" => option_name,
|
87
93
|
"value" => option_value,
|
94
|
+
"parameter_type" => option_parameter_type,
|
88
95
|
"hidden_value" => option_hidden_value
|
89
96
|
}
|
90
97
|
}.merge(base_action_params)
|