hammer_cli_foreman 2.5.1 → 3.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/doc/release_notes.md +31 -1
- data/lib/hammer_cli_foreman/architecture.rb +5 -5
- data/lib/hammer_cli_foreman/associating_commands.rb +0 -24
- data/lib/hammer_cli_foreman/bookmark.rb +5 -5
- data/lib/hammer_cli_foreman/combination.rb +3 -13
- data/lib/hammer_cli_foreman/command_extensions/domain.rb +20 -0
- data/lib/hammer_cli_foreman/command_extensions/subnet.rb +25 -10
- data/lib/hammer_cli_foreman/command_extensions/user.rb +9 -5
- data/lib/hammer_cli_foreman/command_extensions.rb +1 -2
- data/lib/hammer_cli_foreman/commands.rb +3 -11
- data/lib/hammer_cli_foreman/compute_attribute.rb +1 -1
- data/lib/hammer_cli_foreman/compute_profile.rb +5 -5
- data/lib/hammer_cli_foreman/compute_resource/libvirt.rb +4 -2
- data/lib/hammer_cli_foreman/compute_resource/vmware.rb +4 -2
- data/lib/hammer_cli_foreman/compute_resource.rb +1 -0
- data/lib/hammer_cli_foreman/domain.rb +5 -28
- data/lib/hammer_cli_foreman/filter.rb +3 -3
- data/lib/hammer_cli_foreman/host.rb +1 -35
- data/lib/hammer_cli_foreman/hostgroup.rb +14 -58
- data/lib/hammer_cli_foreman/hosts/common_update_options.rb +8 -30
- data/lib/hammer_cli_foreman/id_resolver.rb +7 -68
- data/lib/hammer_cli_foreman/location.rb +0 -6
- data/lib/hammer_cli_foreman/mail_notification.rb +2 -2
- data/lib/hammer_cli_foreman/model.rb +5 -5
- data/lib/hammer_cli_foreman/operating_system.rb +10 -10
- data/lib/hammer_cli_foreman/option_builders.rb +65 -53
- data/lib/hammer_cli_foreman/option_sources/id_params.rb +41 -11
- data/lib/hammer_cli_foreman/option_sources/ids_params.rb +39 -7
- data/lib/hammer_cli_foreman/option_sources.rb +0 -1
- data/lib/hammer_cli_foreman/organization.rb +0 -6
- data/lib/hammer_cli_foreman/references.rb +0 -16
- data/lib/hammer_cli_foreman/settings.rb +3 -3
- data/lib/hammer_cli_foreman/smart_proxy.rb +7 -57
- data/lib/hammer_cli_foreman/template.rb +3 -15
- data/lib/hammer_cli_foreman/user.rb +5 -4
- data/lib/hammer_cli_foreman/usergroup.rb +5 -5
- data/lib/hammer_cli_foreman/version.rb +1 -1
- data/lib/hammer_cli_foreman.rb +0 -21
- data/lib/minitest/coverage_reporter.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/3.1/foreman_api.json +1 -0
- data/test/functional/architecture_test.rb +6 -4
- data/test/functional/bookmark_test.rb +3 -1
- data/test/functional/compute_attribute_test.rb +20 -20
- data/test/functional/compute_profile_test.rb +3 -1
- data/test/functional/domain/create_test.rb +91 -0
- data/test/functional/domain/update_test.rb +90 -0
- data/test/functional/host_test.rb +34 -1
- data/test/functional/hostgroup/create_test.rb +11 -117
- data/test/functional/hostgroup/update_test.rb +11 -79
- data/test/functional/location_test.rb +0 -3
- data/test/functional/mail_notification_test.rb +3 -1
- data/test/functional/model_test.rb +3 -1
- data/test/functional/operating_system_test.rb +3 -1
- data/test/functional/personal_access_token_test.rb +4 -4
- data/test/functional/settings_test.rb +4 -4
- data/test/functional/template_test.rb +76 -49
- data/test/functional/user_mail_notification_test.rb +3 -3
- data/test/functional/usergroup_test.rb +3 -1
- data/test/test_helper.rb +1 -1
- data/test/unit/apipie_resource_mock.rb +1 -39
- data/test/unit/architecture_test.rb +10 -10
- data/test/unit/bookmark_test.rb +10 -14
- data/test/unit/commands_test.rb +1 -2
- data/test/unit/compute_profile_test.rb +10 -10
- data/test/unit/helpers/command.rb +0 -8
- data/test/unit/host_test.rb +14 -61
- data/test/unit/hostgroup_test.rb +7 -26
- data/test/unit/id_resolver_test.rb +0 -28
- data/test/unit/mail_notification_test.rb +4 -4
- data/test/unit/model_test.rb +47 -47
- data/test/unit/operating_system_test.rb +10 -16
- data/test/unit/option_builders_test.rb +88 -83
- data/test/unit/settings_test.rb +4 -4
- data/test/unit/smart_proxy_test.rb +0 -12
- data/test/unit/usergroup_test.rb +10 -10
- metadata +70 -84
- data/lib/hammer_cli_foreman/command_extensions/puppet_environment.rb +0 -29
- data/lib/hammer_cli_foreman/command_extensions/puppet_environments.rb +0 -29
- data/lib/hammer_cli_foreman/config_group.rb +0 -45
- data/lib/hammer_cli_foreman/option_sources/puppet_environment_params.rb +0 -59
- data/lib/hammer_cli_foreman/puppet_class.rb +0 -61
- data/lib/hammer_cli_foreman/puppet_environment.rb +0 -65
- data/lib/hammer_cli_foreman/smart_class_parameter.rb +0 -189
- data/test/functional/config_group_test.rb +0 -50
- data/test/functional/proxy_test.rb +0 -86
- data/test/functional/smart_class_parameter_test.rb +0 -97
- data/test/unit/config_group_test.rb +0 -82
- data/test/unit/puppet_class_test.rb +0 -72
- data/test/unit/puppet_environment_test.rb +0 -114
- data/test/unit/smart_class_parameter_test.rb +0 -113
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 87407ba2c43be96a076220e9500050007447596f6d14024932fa85a7c9046f20
|
4
|
+
data.tar.gz: 2987c54ab5fef04cc45629754a55c62d16a252b6cd950e7de461a989712a79ca
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 030d7c3ff4d19fb767e771c123b8cb0de2a6166cec3ec2012b689f7d920d3049a234f7900ee43141c2af97ce0d5aaf403ea9a9f3962072bdffc181126de57e70
|
7
|
+
data.tar.gz: 6acaf9a9b06c59b4c7db28b73bdc7dfe31170ac3b621adb2b85a5a501090e310a4fcfc703e2b6dc48170a693ff675507b8b9c478a8c344ff7793bfe778a8f3f3
|
data/doc/release_notes.md
CHANGED
@@ -1,7 +1,37 @@
|
|
1
1
|
Release notes
|
2
2
|
=============
|
3
|
-
### 2.
|
3
|
+
### 3.2.0 (2022-02-10)
|
4
|
+
* Domain update doesn't reset dns implicitly ([PR #591](https://github.com/theforeman/hammer-cli-foreman/pull/591)), [#34177](http://projects.theforeman.org/issues/34177)
|
5
|
+
* Send filter's tax params only when required ([PR #592](https://github.com/theforeman/hammer-cli-foreman/pull/592)), [#34199](http://projects.theforeman.org/issues/34199)
|
6
|
+
* Add boot_order to compute-attribute ([PR #588](https://github.com/theforeman/hammer-cli-foreman/pull/588)), [#33910](http://projects.theforeman.org/issues/33910)
|
7
|
+
* Add mail_enabled to user list/info command ([PR #589](https://github.com/theforeman/hammer-cli-foreman/pull/589)), [#34180](http://projects.theforeman.org/issues/34180)
|
8
|
+
* Add token to host info command ([PR #586](https://github.com/theforeman/hammer-cli-foreman/pull/586)), [#34120](http://projects.theforeman.org/issues/34120)
|
9
|
+
* Bump to 3.2.0-develop
|
10
|
+
|
11
|
+
### 3.1.0 (2021-11-10)
|
12
|
+
* Update test data for 3.1
|
13
|
+
* Make sure provided options override defaults, [#33711](http://projects.theforeman.org/issues/33711)
|
14
|
+
* Make template create/update commands use resolver, [#33721](http://projects.theforeman.org/issues/33721)
|
15
|
+
* Revert fix rake version
|
16
|
+
* Fix rake version
|
17
|
+
* Show status once for proxy info ([PR #581](https://github.com/theforeman/hammer-cli-foreman/pull/581)), [#19510](http://projects.theforeman.org/issues/19510)
|
18
|
+
* Add proxy status and version to info command ([PR #572](https://github.com/theforeman/hammer-cli-foreman/pull/572))
|
19
|
+
* Associate a vm via hammer to a compute resource, [#33047](http://projects.theforeman.org/issues/33047)
|
20
|
+
* Fix option builders and tests, [#33226](http://projects.theforeman.org/issues/33226)
|
21
|
+
* Bump to 3.1.0-develop
|
22
|
+
* Add parent title option for hostgroup, [#32878](http://projects.theforeman.org/issues/32878)
|
23
|
+
|
24
|
+
### 3.0.0 (2021-08-04)
|
25
|
+
* Puppet extraction ([PR #571](https://github.com/theforeman/hammer-cli-foreman/pull/571)), [#33174](http://projects.theforeman.org/issues/33174)
|
26
|
+
* Update rel-eng notebook ([PR #573](https://github.com/theforeman/hammer-cli-foreman/pull/573))
|
27
|
+
* Bump version to 3.0-develop
|
28
|
+
* Deprecate root-pass and remove deprecation warning, [#22574](http://projects.theforeman.org/issues/22574)
|
29
|
+
* Return org and loc options to all hammer commands ([PR #575](https://github.com/theforeman/hammer-cli-foreman/pull/575)), [#32872](http://projects.theforeman.org/issues/32872)
|
30
|
+
* prevent full-help from failure if apidoc not available ([PR #574](https://github.com/theforeman/hammer-cli-foreman/pull/574)), [#32861](http://projects.theforeman.org/issues/32861)
|
4
31
|
* Show new msg for empty update commands, [#32454](http://projects.theforeman.org/issues/32454)
|
32
|
+
* Remove --environment deprecations ([PR #569](https://github.com/theforeman/hammer-cli-foreman/pull/569)), [#28862](http://projects.theforeman.org/issues/28862)
|
33
|
+
* Force name resolving due defaults, [#32392](http://projects.theforeman.org/issues/32392)
|
34
|
+
* Bump to 2.6.0-develop
|
5
35
|
|
6
36
|
### 2.5.0 (2021-05-04)
|
7
37
|
* Update test data to latest foreman
|
@@ -11,7 +11,7 @@ module HammerCLIForeman
|
|
11
11
|
field :name, _("Name")
|
12
12
|
end
|
13
13
|
|
14
|
-
build_options
|
14
|
+
build_options
|
15
15
|
end
|
16
16
|
|
17
17
|
|
@@ -23,7 +23,7 @@ module HammerCLIForeman
|
|
23
23
|
HammerCLIForeman::References.timestamps(self)
|
24
24
|
end
|
25
25
|
|
26
|
-
build_options
|
26
|
+
build_options
|
27
27
|
end
|
28
28
|
|
29
29
|
|
@@ -31,7 +31,7 @@ module HammerCLIForeman
|
|
31
31
|
success_message _("Architecture created.")
|
32
32
|
failure_message _("Could not create the architecture")
|
33
33
|
|
34
|
-
build_options
|
34
|
+
build_options
|
35
35
|
end
|
36
36
|
|
37
37
|
|
@@ -39,7 +39,7 @@ module HammerCLIForeman
|
|
39
39
|
success_message _("Architecture deleted.")
|
40
40
|
failure_message _("Could not delete the architecture")
|
41
41
|
|
42
|
-
build_options
|
42
|
+
build_options
|
43
43
|
end
|
44
44
|
|
45
45
|
|
@@ -47,7 +47,7 @@ module HammerCLIForeman
|
|
47
47
|
success_message _("Architecture updated.")
|
48
48
|
failure_message _("Could not update the architecture")
|
49
49
|
|
50
|
-
build_options
|
50
|
+
build_options
|
51
51
|
end
|
52
52
|
|
53
53
|
HammerCLIForeman::AssociatingCommands::OperatingSystem.extend_command(self)
|
@@ -53,30 +53,6 @@ module HammerCLIForeman
|
|
53
53
|
end
|
54
54
|
end
|
55
55
|
|
56
|
-
module PuppetEnvironment
|
57
|
-
extend CommandExtension
|
58
|
-
|
59
|
-
class AddPuppetEnvironmentCommand < HammerCLIForeman::AddAssociatedCommand
|
60
|
-
associated_resource :environments
|
61
|
-
desc _('Associate a Puppet environment')
|
62
|
-
|
63
|
-
success_message _("The environment has been associated.")
|
64
|
-
failure_message _("Could not associate the environment")
|
65
|
-
|
66
|
-
extend_with(HammerCLIForeman::CommandExtensions::PuppetEnvironment.new)
|
67
|
-
end
|
68
|
-
|
69
|
-
class RemovePuppetEnvironmentCommand < HammerCLIForeman::RemoveAssociatedCommand
|
70
|
-
associated_resource :environments
|
71
|
-
desc _('Disassociate a Puppet environment')
|
72
|
-
|
73
|
-
success_message _("The environment has been disassociated.")
|
74
|
-
failure_message _("Could not disassociate the environment")
|
75
|
-
|
76
|
-
extend_with(HammerCLIForeman::CommandExtensions::PuppetEnvironment.new)
|
77
|
-
end
|
78
|
-
end
|
79
|
-
|
80
56
|
module Domain
|
81
57
|
extend CommandExtension
|
82
58
|
|
@@ -15,34 +15,34 @@ module HammerCLIForeman
|
|
15
15
|
field :owner_type, _('Owner Type')
|
16
16
|
end
|
17
17
|
|
18
|
-
build_options
|
18
|
+
build_options
|
19
19
|
end
|
20
20
|
|
21
21
|
class InfoCommand < HammerCLIForeman::InfoCommand
|
22
22
|
output ListCommand.output_definition
|
23
23
|
|
24
|
-
build_options
|
24
|
+
build_options
|
25
25
|
end
|
26
26
|
|
27
27
|
class CreateCommand < HammerCLIForeman::CreateCommand
|
28
28
|
success_message _('Bookmark %<name>s created.')
|
29
29
|
failure_message _('Failed to create %<name>s bookmark')
|
30
30
|
|
31
|
-
build_options
|
31
|
+
build_options
|
32
32
|
end
|
33
33
|
|
34
34
|
class UpdateCommand < HammerCLIForeman::UpdateCommand
|
35
35
|
success_message _('Bookmark %<name>s updated successfully.')
|
36
36
|
failure_message _('Failed to update %<name>s bookmark')
|
37
37
|
|
38
|
-
build_options
|
38
|
+
build_options
|
39
39
|
end
|
40
40
|
|
41
41
|
class DeleteCommand < HammerCLIForeman::DeleteCommand
|
42
42
|
success_message _('Bookmark deleted successfully.')
|
43
43
|
failure_message _('Failed to delete bookmark')
|
44
44
|
|
45
|
-
build_options
|
45
|
+
build_options
|
46
46
|
end
|
47
47
|
|
48
48
|
autoload_subcommands
|
@@ -6,8 +6,7 @@ module HammerCLIForeman
|
|
6
6
|
|
7
7
|
module RequestParams
|
8
8
|
def request_params
|
9
|
-
combination_params = { 'hostgroup_id' => params['hostgroup_id'].to_s
|
10
|
-
'environment_id' => params['environment_id'].to_s }
|
9
|
+
combination_params = { 'hostgroup_id' => params['hostgroup_id'].to_s }
|
11
10
|
super.merge('template_combination' => combination_params)
|
12
11
|
end
|
13
12
|
end
|
@@ -21,8 +20,6 @@ module HammerCLIForeman
|
|
21
20
|
field :provisioning_template_name, _('Provisioning template name')
|
22
21
|
field :hostgroup_id, _('Hostgroup ID')
|
23
22
|
field :hostgroup_name, _('Hostgroup name')
|
24
|
-
field :environment_id, _('Environment ID')
|
25
|
-
field :environment_name, _('Environment name')
|
26
23
|
|
27
24
|
HammerCLIForeman::References.taxonomies(self)
|
28
25
|
HammerCLIForeman::References.timestamps(self)
|
@@ -31,8 +28,6 @@ module HammerCLIForeman
|
|
31
28
|
build_options do |o|
|
32
29
|
o.expand(:all)
|
33
30
|
end
|
34
|
-
|
35
|
-
extend_with(HammerCLIForeman::CommandExtensions::PuppetEnvironment.new)
|
36
31
|
end
|
37
32
|
|
38
33
|
class ListCombination < HammerCLIForeman::ListCommand
|
@@ -40,12 +35,11 @@ module HammerCLIForeman
|
|
40
35
|
field :id, _('ID')
|
41
36
|
field nil, _('Provisioning Template'), Fields::SingleReference, :key => :provisioning_template
|
42
37
|
field nil, _('Hostgroup'), Fields::SingleReference, :key => :hostgroup
|
43
|
-
field nil, _('Environment'), Fields::SingleReference, :key => :environment
|
44
38
|
end
|
45
39
|
|
46
40
|
build_options do |o|
|
47
|
-
o.expand(:all).except(:hostgroups
|
48
|
-
o.without(:hostgroup_id
|
41
|
+
o.expand(:all).except(:hostgroups)
|
42
|
+
o.without(:hostgroup_id)
|
49
43
|
end
|
50
44
|
end
|
51
45
|
|
@@ -58,8 +52,6 @@ module HammerCLIForeman
|
|
58
52
|
build_options do |o|
|
59
53
|
o.expand(:all)
|
60
54
|
end
|
61
|
-
|
62
|
-
extend_with(HammerCLIForeman::CommandExtensions::PuppetEnvironment.new)
|
63
55
|
end
|
64
56
|
|
65
57
|
class CreateCombination < HammerCLIForeman::CreateCommand
|
@@ -71,8 +63,6 @@ module HammerCLIForeman
|
|
71
63
|
build_options do |o|
|
72
64
|
o.expand(:all)
|
73
65
|
end
|
74
|
-
|
75
|
-
extend_with(HammerCLIForeman::CommandExtensions::PuppetEnvironment.new)
|
76
66
|
end
|
77
67
|
|
78
68
|
class DeleteCombination < HammerCLIForeman::DeleteCommand
|
@@ -0,0 +1,20 @@
|
|
1
|
+
module HammerCLIForeman
|
2
|
+
module CommandExtensions
|
3
|
+
class Domain < HammerCLI::CommandExtensions
|
4
|
+
option_sources do |sources, command|
|
5
|
+
sources.find_by_name('IdResolution').insert_relative(
|
6
|
+
:after,
|
7
|
+
'IdParams',
|
8
|
+
HammerCLIForeman::OptionSources::ReferencedResourceIdParams.new(command)
|
9
|
+
)
|
10
|
+
sources
|
11
|
+
end
|
12
|
+
|
13
|
+
option_family associate: 'dns' do
|
14
|
+
child '--dns', 'DNS_NAME', _('Name of DNS proxy to use within this domain'),
|
15
|
+
attribute_name: :option_dns_name,
|
16
|
+
referenced_resource: :smart_proxy
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
@@ -1,16 +1,7 @@
|
|
1
1
|
module HammerCLIForeman
|
2
2
|
module CommandExtensions
|
3
3
|
class Subnet < HammerCLI::CommandExtensions
|
4
|
-
option
|
5
|
-
attribute_name: :option_dns_name,
|
6
|
-
referenced_resource: :smart_proxy
|
7
|
-
option "--dhcp", "DHCP_NAME", _("DHCP Proxy to use within this subnet"),
|
8
|
-
attribute_name: :option_dhcp_name,
|
9
|
-
referenced_resource: :smart_proxy
|
10
|
-
option "--tftp", "TFTP_NAME", _("TFTP Proxy to use within this subnet"),
|
11
|
-
attribute_name: :option_tftp_name,
|
12
|
-
referenced_resource: :smart_proxy
|
13
|
-
option "--prefix", "PREFIX", _("Network prefix in CIDR notation (e.g. 64) for this subnet")
|
4
|
+
option '--prefix', 'PREFIX', _('Network prefix in CIDR notation (e.g. 64) for this subnet')
|
14
5
|
|
15
6
|
option_sources do |sources, command|
|
16
7
|
sources.find_by_name('IdResolution').insert_relative(
|
@@ -20,6 +11,30 @@ module HammerCLIForeman
|
|
20
11
|
)
|
21
12
|
sources
|
22
13
|
end
|
14
|
+
|
15
|
+
option_family associate: 'tftp' do
|
16
|
+
child '--tftp', 'TFTP_NAME', _('TFTP Proxy to use within this subnet'),
|
17
|
+
attribute_name: :option_tftp_name,
|
18
|
+
referenced_resource: :smart_proxy
|
19
|
+
end
|
20
|
+
|
21
|
+
option_family associate: 'dns' do
|
22
|
+
child '--dns', 'DNS_NAME', _('DNS Proxy to use within this subnet'),
|
23
|
+
attribute_name: :option_dns_name,
|
24
|
+
referenced_resource: :smart_proxy
|
25
|
+
end
|
26
|
+
|
27
|
+
option_family associate: 'dhcp' do
|
28
|
+
child '--dhcp', 'DHCP_NAME', _('DHCP Proxy to use within this subnet'),
|
29
|
+
attribute_name: :option_dhcp_name,
|
30
|
+
referenced_resource: :smart_proxy
|
31
|
+
end
|
32
|
+
|
33
|
+
option_family associate: 'bmc' do
|
34
|
+
child '--bmc', 'BMC_NAME', _('BMC Proxy to use within this subnet'),
|
35
|
+
attribute_name: :option_bmc_name,
|
36
|
+
referenced_resource: :smart_proxy
|
37
|
+
end
|
23
38
|
end
|
24
39
|
end
|
25
40
|
end
|
@@ -1,17 +1,21 @@
|
|
1
1
|
module HammerCLIForeman
|
2
2
|
module CommandExtensions
|
3
3
|
class User < HammerCLI::CommandExtensions
|
4
|
-
option '--default-organization', 'DEFAULT_ORGANIZATION_NAME', _('Default organization name'),
|
5
|
-
aliased_resource: 'default_organization', referenced_resource: 'default_organization'
|
6
|
-
option '--default-location', 'DEFAULT_LOCATION_NAME', _('Default location name'),
|
7
|
-
aliased_resource: 'default_location', referenced_resource: 'default_location'
|
8
|
-
|
9
4
|
option '--ask-password', 'ASK_PW', ' ', format: HammerCLI::Options::Normalizers::Bool.new
|
10
5
|
|
11
6
|
option_sources do |sources, command|
|
12
7
|
sources << HammerCLIForeman::OptionSources::UserParams.new(command)
|
13
8
|
sources
|
14
9
|
end
|
10
|
+
|
11
|
+
option_family associate: 'default_organization' do
|
12
|
+
child '--default-organization', 'DEFAULT_ORGANIZATION_NAME', _('Default organization name'),
|
13
|
+
aliased_resource: 'default_organization', referenced_resource: 'organization'
|
14
|
+
end
|
15
|
+
option_family associate: 'default_location' do
|
16
|
+
child '--default-location', 'DEFAULT_LOCATION_NAME', _('Default location name'),
|
17
|
+
aliased_resource: 'default_location', referenced_resource: 'location'
|
18
|
+
end
|
15
19
|
end
|
16
20
|
end
|
17
21
|
end
|
@@ -1,10 +1,9 @@
|
|
1
1
|
require 'hammer_cli_foreman/command_extensions/update_common'
|
2
2
|
require 'hammer_cli_foreman/command_extensions/fields'
|
3
|
-
require 'hammer_cli_foreman/command_extensions/puppet_environment'
|
4
|
-
require 'hammer_cli_foreman/command_extensions/puppet_environments'
|
5
3
|
require 'hammer_cli_foreman/command_extensions/option_sources'
|
6
4
|
require 'hammer_cli_foreman/command_extensions/hosts'
|
7
5
|
require 'hammer_cli_foreman/command_extensions/ping'
|
8
6
|
require 'hammer_cli_foreman/command_extensions/status'
|
9
7
|
require 'hammer_cli_foreman/command_extensions/user'
|
10
8
|
require 'hammer_cli_foreman/command_extensions/subnet'
|
9
|
+
require 'hammer_cli_foreman/command_extensions/domain'
|
@@ -7,16 +7,9 @@ module HammerCLIForeman
|
|
7
7
|
:usergroups => :user_groups,
|
8
8
|
:ptable => :partition_table,
|
9
9
|
:ptables => :partition_tables,
|
10
|
-
:puppetclass => :puppet_class,
|
11
|
-
:puppetclasses => :puppet_classes,
|
12
|
-
:environment => :puppet_environment,
|
13
|
-
:environments => :puppet_environments
|
14
10
|
}
|
15
11
|
|
16
|
-
RESOURCE_ALIAS_NAME_MAPPING = {
|
17
|
-
environment: :puppet_environment,
|
18
|
-
environments: :puppet_environments
|
19
|
-
}
|
12
|
+
RESOURCE_ALIAS_NAME_MAPPING = { }
|
20
13
|
|
21
14
|
def self.foreman_api
|
22
15
|
foreman_api_connection
|
@@ -104,9 +97,8 @@ module HammerCLIForeman
|
|
104
97
|
configurator = BuilderConfigurator.new(searchables, dependency_resolver)
|
105
98
|
|
106
99
|
builder = ForemanOptionBuilder.new(searchables)
|
107
|
-
builder.builders =
|
100
|
+
builder.builders = super.builders
|
108
101
|
builder.builders += configurator.builders_for(resource, resource.action(action)) if resource_defined?
|
109
|
-
builder.builders += super.builders
|
110
102
|
builder
|
111
103
|
end
|
112
104
|
|
@@ -294,7 +286,7 @@ module HammerCLIForeman
|
|
294
286
|
def help
|
295
287
|
return super unless resource
|
296
288
|
|
297
|
-
meta = resource.action(action).apidoc
|
289
|
+
meta = resource.action(action).apidoc&.dig(:metadata)
|
298
290
|
if meta && meta[:search] && respond_to?(:option_search)
|
299
291
|
self.class.extend_help do |h|
|
300
292
|
h.section(_('Search / Order fields'), id: :search_fields_section) do |h|
|
@@ -12,7 +12,7 @@ module HammerCLIForeman
|
|
12
12
|
profile = HammerCLIForeman.record_to_common_format(
|
13
13
|
HammerCLIForeman.foreman_resource(:compute_profiles).call(:show, 'id' => options['option_compute_profile_id'] )
|
14
14
|
)
|
15
|
-
params['compute_attribute'] = profile['compute_attributes'].select { |hash| hash['compute_resource_id'] == options['option_compute_resource_id']}[0] || {}
|
15
|
+
params['compute_attribute'] = profile['compute_attributes'].select { |hash| hash['compute_resource_id'].to_s == options['option_compute_resource_id'].to_s}[0] || {}
|
16
16
|
params['compute_attribute'].delete('attributes') if params['compute_attribute']['attributes']
|
17
17
|
params
|
18
18
|
end
|
@@ -9,7 +9,7 @@ module HammerCLIForeman
|
|
9
9
|
field :id, _('Id')
|
10
10
|
field :name, _('Name')
|
11
11
|
end
|
12
|
-
build_options
|
12
|
+
build_options
|
13
13
|
end
|
14
14
|
|
15
15
|
class InfoCommand < HammerCLIForeman::InfoCommand
|
@@ -25,13 +25,13 @@ module HammerCLIForeman
|
|
25
25
|
field :vm_attrs, _('VM attributes')
|
26
26
|
end
|
27
27
|
end
|
28
|
-
build_options
|
28
|
+
build_options
|
29
29
|
end
|
30
30
|
|
31
31
|
class CreateCommand < HammerCLIForeman::CreateCommand
|
32
32
|
success_message _('Compute profile created.')
|
33
33
|
failure_message _('Could not create a compute profile')
|
34
|
-
build_options
|
34
|
+
build_options
|
35
35
|
end
|
36
36
|
|
37
37
|
class UpdateCommand < HammerCLIForeman::UpdateCommand
|
@@ -40,7 +40,7 @@ module HammerCLIForeman
|
|
40
40
|
validate_options do
|
41
41
|
any(:option_name,:option_id).required
|
42
42
|
end
|
43
|
-
build_options
|
43
|
+
build_options
|
44
44
|
end
|
45
45
|
|
46
46
|
class DeleteCommand < HammerCLIForeman::DeleteCommand
|
@@ -49,7 +49,7 @@ module HammerCLIForeman
|
|
49
49
|
validate_options do
|
50
50
|
any(:option_name,:option_id).required
|
51
51
|
end
|
52
|
-
build_options
|
52
|
+
build_options
|
53
53
|
end
|
54
54
|
|
55
55
|
lazy_subcommand('values', _("Create update and delete Compute profile values"),
|
@@ -9,7 +9,8 @@ module HammerCLIForeman
|
|
9
9
|
[
|
10
10
|
['cpus', _('Number of CPUs'), { bold: true }],
|
11
11
|
['memory', _('String, amount of memory, value in bytes'), { bold: true }],
|
12
|
-
['cpu_mode', _('Possible values: %{modes}') % { modes: 'default, host-model, host-passthrough' }]
|
12
|
+
['cpu_mode', _('Possible values: %{modes}') % { modes: 'default, host-model, host-passthrough' }],
|
13
|
+
['boot_order', _('Device names to specify the boot order')]
|
13
14
|
]
|
14
15
|
end
|
15
16
|
|
@@ -48,7 +49,8 @@ module HammerCLIForeman
|
|
48
49
|
Fields::Field.new(:label => _('Status'), :path => [:state]),
|
49
50
|
Fields::Field.new(:label => _('OS Type'), :path => [:os_type]),
|
50
51
|
Fields::Field.new(:label => _('Domain Type'), :path => [:domain_type]),
|
51
|
-
Fields::Field.new(:label => _('Persistent'), :path => [:persistent])
|
52
|
+
Fields::Field.new(:label => _('Persistent'), :path => [:persistent]),
|
53
|
+
Fields::List.new(:label => _('Boot order'), :path => [:boot_order])
|
52
54
|
]
|
53
55
|
end
|
54
56
|
|
@@ -25,7 +25,8 @@ module HammerCLIForeman
|
|
25
25
|
['scsi_controllers', [_('List with SCSI controllers definitions'),
|
26
26
|
' type - ' + _('ID of the controller from VMware'),
|
27
27
|
' key - ' + _('Key of the controller (e.g. 1000)')
|
28
|
-
].flatten(1).join("\n")]
|
28
|
+
].flatten(1).join("\n")],
|
29
|
+
['boot_order', _('Device names to specify the boot order')]
|
29
30
|
]
|
30
31
|
end
|
31
32
|
|
@@ -76,7 +77,8 @@ module HammerCLIForeman
|
|
76
77
|
Fields::Field.new(:label => _('Connection Status'), :path => [:connection_status]),
|
77
78
|
Fields::Field.new(:label => _('Hardware Version'), :path => [:hardware_version]),
|
78
79
|
Fields::Field.new(:label => _('Path'), :path => [:path]),
|
79
|
-
Fields::Field.new(:label => _('Operating System'), :path => [:operatingsystem])
|
80
|
+
Fields::Field.new(:label => _('Operating System'), :path => [:operatingsystem]),
|
81
|
+
Fields::List.new(:label => _('Boot order'), :path => [:boot_order])
|
80
82
|
]
|
81
83
|
end
|
82
84
|
|
@@ -107,6 +107,7 @@ module HammerCLIForeman
|
|
107
107
|
class AssociateVmsCommand < HammerCLIForeman::Command
|
108
108
|
action :associate
|
109
109
|
command_name 'associate-vms'
|
110
|
+
option "--vm-id","VM ID", _("Associate a specific VM")
|
110
111
|
success_message _("Virtual machines have been associated.")
|
111
112
|
failure_message _("Could not associate the virtual machines")
|
112
113
|
|
@@ -1,28 +1,5 @@
|
|
1
1
|
module HammerCLIForeman
|
2
|
-
|
3
|
-
module DomainUpdateCreateCommons
|
4
|
-
|
5
|
-
def self.included(base)
|
6
|
-
base.option "--dns-id", "DNS_ID", _("ID of DNS proxy to use within this domain")
|
7
|
-
base.option "--dns", "DNS_NAME", _("Name of DNS proxy to use within this domain")
|
8
|
-
end
|
9
|
-
|
10
|
-
def request_params
|
11
|
-
params = super
|
12
|
-
params['domain']["dns_id"] = option_dns_id || dns_id(option_dns)
|
13
|
-
params
|
14
|
-
end
|
15
|
-
|
16
|
-
private
|
17
|
-
|
18
|
-
def dns_id(name)
|
19
|
-
resolver.smart_proxy_id('option_name' => name) if name
|
20
|
-
end
|
21
|
-
|
22
|
-
end
|
23
|
-
|
24
2
|
class Domain < HammerCLIForeman::Command
|
25
|
-
|
26
3
|
resource :domains
|
27
4
|
|
28
5
|
class ListCommand < HammerCLIForeman::ListCommand
|
@@ -52,24 +29,24 @@ module HammerCLIForeman
|
|
52
29
|
|
53
30
|
|
54
31
|
class CreateCommand < HammerCLIForeman::CreateCommand
|
55
|
-
include DomainUpdateCreateCommons
|
56
|
-
|
57
32
|
success_message _("Domain [%{name}] created.")
|
58
33
|
failure_message _("Could not create the domain")
|
59
34
|
|
60
35
|
option "--description", "DESC", _("Full name describing the domain"), :attribute_name => :option_fullname
|
61
|
-
build_options :without => [:domain_parameters_attributes, :fullname
|
36
|
+
build_options :without => [:domain_parameters_attributes, :fullname]
|
37
|
+
|
38
|
+
extend_with(HammerCLIForeman::CommandExtensions::Domain.new)
|
62
39
|
end
|
63
40
|
|
64
41
|
|
65
42
|
class UpdateCommand < HammerCLIForeman::UpdateCommand
|
66
|
-
include DomainUpdateCreateCommons
|
67
|
-
|
68
43
|
success_message _("Domain [%{name}] updated.")
|
69
44
|
failure_message _("Could not update the domain")
|
70
45
|
|
71
46
|
option "--description", "DESC", _("Full name describing the domain"), :attribute_name => :option_fullname
|
72
47
|
build_options :without => [:domain_parameters_attributes, :fullname]
|
48
|
+
|
49
|
+
extend_with(HammerCLIForeman::CommandExtensions::Domain.new)
|
73
50
|
end
|
74
51
|
|
75
52
|
|
@@ -97,10 +97,10 @@ module HammerCLIForeman
|
|
97
97
|
|
98
98
|
def request_params
|
99
99
|
params = super
|
100
|
-
|
100
|
+
unless override?
|
101
101
|
# Clear taxonomies in case the filter is switching override from true to false
|
102
|
-
params['filter']['location_ids'] = []
|
103
|
-
params['filter']['organization_ids'] = []
|
102
|
+
params['filter']['location_ids'] = [] if !@filter || !@filter['locations'].empty?
|
103
|
+
params['filter']['organization_ids'] = [] if !@filter || !@filter['organizations'].empty?
|
104
104
|
end
|
105
105
|
params
|
106
106
|
end
|
@@ -1,7 +1,5 @@
|
|
1
1
|
require 'hammer_cli_foreman/fact'
|
2
2
|
require 'hammer_cli_foreman/config_report'
|
3
|
-
require 'hammer_cli_foreman/puppet_class'
|
4
|
-
require 'hammer_cli_foreman/smart_class_parameter'
|
5
3
|
require 'hammer_cli_foreman/interface'
|
6
4
|
require 'hammer_cli_foreman/hosts/common_update_options'
|
7
5
|
require 'hammer_cli_foreman/compute_resource/register_compute_resources'
|
@@ -31,8 +29,6 @@ module HammerCLIForeman
|
|
31
29
|
end
|
32
30
|
|
33
31
|
build_options :without => [:include]
|
34
|
-
|
35
|
-
extend_with(HammerCLIForeman::CommandExtensions::PuppetEnvironment.new)
|
36
32
|
end
|
37
33
|
|
38
34
|
|
@@ -58,10 +54,8 @@ module HammerCLIForeman
|
|
58
54
|
field nil, _("Host Group"), Fields::SingleReference, :key => :hostgroup, :display_field => 'title'
|
59
55
|
field nil, _("Compute Resource"), Fields::SingleReference, :key => :compute_resource
|
60
56
|
field nil, _("Compute Profile"), Fields::SingleReference, :key => :compute_profile, :hide_blank => true
|
61
|
-
field nil, _("Puppet Environment"), Fields::SingleReference, :key => :environment
|
62
|
-
field nil, _("Puppet CA Proxy"), Fields::SingleReference, :key => :puppet_ca_proxy
|
63
|
-
field nil, _("Puppet Master Proxy"), Fields::SingleReference, :key => :puppet_proxy
|
64
57
|
field :certname, _("Cert name")
|
58
|
+
field :token, _("Token")
|
65
59
|
field :managed, _("Managed"), Fields::Boolean
|
66
60
|
|
67
61
|
field :installed_at, _("Installed at"), Fields::Date
|
@@ -191,23 +185,6 @@ module HammerCLIForeman
|
|
191
185
|
build_options
|
192
186
|
end
|
193
187
|
|
194
|
-
|
195
|
-
class PuppetClassesCommand < HammerCLIForeman::ListCommand
|
196
|
-
command_name "puppet-classes"
|
197
|
-
resource :puppetclasses
|
198
|
-
|
199
|
-
output HammerCLIForeman::PuppetClass::ListCommand.output_definition
|
200
|
-
|
201
|
-
def send_request
|
202
|
-
HammerCLIForeman::PuppetClass::ListCommand.unhash_classes(super)
|
203
|
-
end
|
204
|
-
|
205
|
-
build_options do |o|
|
206
|
-
o.without(:hostgroup_id, :environment_id)
|
207
|
-
o.expand.only(:hosts)
|
208
|
-
end
|
209
|
-
end
|
210
|
-
|
211
188
|
class ConfigReportsCommand < HammerCLIForeman::ListCommand
|
212
189
|
command_name 'config-reports'
|
213
190
|
resource :config_reports, :index
|
@@ -293,7 +270,6 @@ module HammerCLIForeman
|
|
293
270
|
end
|
294
271
|
end
|
295
272
|
|
296
|
-
extend_with(HammerCLIForeman::CommandExtensions::PuppetEnvironment.new)
|
297
273
|
extend_with(HammerCLIForeman::CommandExtensions::Hosts::Help::Interfaces.new)
|
298
274
|
extend_with(HammerCLIForeman::CommandExtensions::Hosts::Help::ComputeResources.custom(add_host_specific_attrs: true).new)
|
299
275
|
end
|
@@ -324,7 +300,6 @@ module HammerCLIForeman
|
|
324
300
|
sources
|
325
301
|
end
|
326
302
|
|
327
|
-
extend_with(HammerCLIForeman::CommandExtensions::PuppetEnvironment.new)
|
328
303
|
extend_with(HammerCLIForeman::CommandExtensions::Hosts::Help::Interfaces.new)
|
329
304
|
extend_with(HammerCLIForeman::CommandExtensions::Hosts::Help::ComputeResources.custom(add_host_specific_attrs: true).new)
|
330
305
|
end
|
@@ -457,15 +432,6 @@ module HammerCLIForeman
|
|
457
432
|
build_options without: [:power_action]
|
458
433
|
end
|
459
434
|
|
460
|
-
class SCParamsCommand < HammerCLIForeman::SmartClassParametersList
|
461
|
-
build_options_for :hosts
|
462
|
-
|
463
|
-
def validate_options
|
464
|
-
super
|
465
|
-
validator.any(:option_host_name, :option_host_id).required
|
466
|
-
end
|
467
|
-
end
|
468
|
-
|
469
435
|
class RebuildConfigCommand < HammerCLIForeman::SingleResourceCommand
|
470
436
|
action :rebuild_config
|
471
437
|
command_name "rebuild-config"
|