hammer_cli_foreman 2.3.2 → 3.0.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/release_notes.md +33 -3
- data/lib/hammer_cli_foreman.rb +3 -21
- data/lib/hammer_cli_foreman/associating_commands.rb +0 -24
- data/lib/hammer_cli_foreman/bookmark.rb +1 -1
- data/lib/hammer_cli_foreman/combination.rb +3 -13
- data/lib/hammer_cli_foreman/command_extensions.rb +1 -2
- data/lib/hammer_cli_foreman/command_extensions/ping.rb +21 -2
- data/lib/hammer_cli_foreman/command_extensions/status.rb +1 -1
- data/lib/hammer_cli_foreman/command_extensions/update_common.rb +14 -0
- data/lib/hammer_cli_foreman/commands.rb +16 -9
- data/lib/hammer_cli_foreman/compute_resource.rb +22 -0
- data/lib/hammer_cli_foreman/compute_resource/ovirt.rb +2 -1
- data/lib/hammer_cli_foreman/config_report.rb +2 -0
- data/lib/hammer_cli_foreman/filter.rb +2 -2
- data/lib/hammer_cli_foreman/host.rb +1 -47
- data/lib/hammer_cli_foreman/hostgroup.rb +2 -53
- data/lib/hammer_cli_foreman/hosts/common_update_options.rb +7 -28
- data/lib/hammer_cli_foreman/id_resolver.rb +0 -61
- data/lib/hammer_cli_foreman/location.rb +0 -6
- data/lib/hammer_cli_foreman/operating_system.rb +2 -1
- data/lib/hammer_cli_foreman/option_builders.rb +6 -5
- data/lib/hammer_cli_foreman/option_sources.rb +0 -1
- data/lib/hammer_cli_foreman/option_sources/id_params.rb +27 -10
- data/lib/hammer_cli_foreman/option_sources/ids_params.rb +25 -6
- data/lib/hammer_cli_foreman/organization.rb +0 -6
- data/lib/hammer_cli_foreman/ping.rb +6 -1
- data/lib/hammer_cli_foreman/references.rb +0 -16
- data/lib/hammer_cli_foreman/registration.rb +18 -0
- data/lib/hammer_cli_foreman/smart_proxy.rb +0 -52
- data/lib/hammer_cli_foreman/version.rb +1 -1
- 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/2.4/foreman_api.json +1 -0
- data/test/data/2.5/foreman_api.json +1 -0
- data/test/functional/architecture_test.rb +81 -0
- data/test/functional/bookmark_test.rb +24 -1
- data/test/functional/compute_profile_test.rb +56 -0
- data/test/functional/compute_resource_test.rb +37 -0
- data/test/functional/filter_test.rb +115 -47
- data/test/functional/host_test.rb +94 -13
- data/test/functional/hostgroup/create_test.rb +0 -117
- data/test/functional/hostgroup/update_test.rb +0 -79
- data/test/functional/http_proxy_test.rb +12 -0
- data/test/functional/location_test.rb +13 -3
- data/test/functional/mail_notification_test.rb +22 -0
- data/test/functional/media_test.rb +11 -0
- data/test/functional/model_test.rb +52 -0
- data/test/functional/operating_system_test.rb +53 -0
- data/test/functional/ping_test.rb +33 -0
- data/test/functional/realm_test.rb +11 -0
- data/test/functional/registration_test.rb +8 -0
- data/test/functional/report_template_test.rb +11 -0
- data/test/functional/settings_test.rb +21 -0
- data/test/functional/status_test.rb +79 -13
- data/test/functional/template_test.rb +16 -37
- data/test/functional/user_test.rb +11 -0
- data/test/functional/usergroup_test.rb +53 -0
- data/test/test_helper.rb +1 -1
- data/test/unit/apipie_resource_mock.rb +22 -39
- data/test/unit/architecture_test.rb +10 -1
- data/test/unit/bookmark_test.rb +95 -0
- data/test/unit/compute_profile_test.rb +87 -0
- data/test/unit/config_report_test.rb +1 -0
- 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 +53 -0
- data/test/unit/model_test.rb +47 -37
- data/test/unit/operating_system_test.rb +10 -3
- data/test/unit/option_sources/id_params_test.rb +9 -0
- data/test/unit/option_sources/ids_params_test.rb +9 -0
- data/test/unit/settings_test.rb +4 -0
- data/test/unit/smart_proxy_test.rb +0 -12
- data/test/unit/usergroup_test.rb +10 -0
- metadata +76 -73
- 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/proxy_test.rb +0 -86
- data/test/functional/smart_class_parameter_test.rb +0 -97
- data/test/unit/config_group_test.rb +0 -72
- 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: 8287acd52ceb1bea84f8d518c3793d521d084ae771622ea7fc4dcccccd794a1b
|
|
4
|
+
data.tar.gz: b557d8fbbc7a451cd09084211c6e8a46a46ef3c198744cbb9c8dc7e861090e93
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 283fd640422b5749f6dc9094907bb1c68e72cef15696704f4493f548dd23ca13bd1066fca15616996d4ff6ba48648d904f5633e3cc3305c30464fa9e22c8bf44
|
|
7
|
+
data.tar.gz: 94b81f8171c914bdd1435ad00a17c1b1606402bac1ab9b21ca3014056ed285029bc79fe2b0646630d964d3b4715bd94b42a67a35f5399cace731ec44c87e4ee8
|
data/doc/release_notes.md
CHANGED
|
@@ -1,10 +1,40 @@
|
|
|
1
1
|
Release notes
|
|
2
2
|
=============
|
|
3
|
-
###
|
|
3
|
+
### 3.0.0 (2021-08-04)
|
|
4
|
+
* Puppet extraction ([PR #571](https://github.com/theforeman/hammer-cli-foreman/pull/571)), [#33174](http://projects.theforeman.org/issues/33174)
|
|
5
|
+
* Update rel-eng notebook ([PR #573](https://github.com/theforeman/hammer-cli-foreman/pull/573))
|
|
6
|
+
* Bump version to 3.0-develop
|
|
7
|
+
* Deprecate root-pass and remove deprecation warning, [#22574](http://projects.theforeman.org/issues/22574)
|
|
8
|
+
* 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)
|
|
9
|
+
* 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)
|
|
10
|
+
* Show new msg for empty update commands, [#32454](http://projects.theforeman.org/issues/32454)
|
|
11
|
+
* Remove --environment deprecations ([PR #569](https://github.com/theforeman/hammer-cli-foreman/pull/569)), [#28862](http://projects.theforeman.org/issues/28862)
|
|
12
|
+
* Force name resolving due defaults, [#32392](http://projects.theforeman.org/issues/32392)
|
|
13
|
+
* Bump to 2.6.0-develop
|
|
14
|
+
|
|
15
|
+
### 2.5.0 (2021-05-04)
|
|
16
|
+
* Update test data to latest foreman
|
|
17
|
+
* change to resource_type_label, [#11454](http://projects.theforeman.org/issues/11454)
|
|
18
|
+
* Display the report origin, [#32428](http://projects.theforeman.org/issues/32428)
|
|
4
19
|
* Apply option family on searchablesoptionbuilder, [#30996](http://projects.theforeman.org/issues/30996)
|
|
5
|
-
|
|
6
|
-
|
|
20
|
+
* Add associate vms command for compute resource ([PR #563](https://github.com/theforeman/hammer-cli-foreman/pull/563)), [#32271](http://projects.theforeman.org/issues/32271)
|
|
21
|
+
* Support unrecognized services in ping, [#32265](http://projects.theforeman.org/issues/32265)
|
|
22
|
+
* Change --owner_type's default to user ([PR #562](https://github.com/theforeman/hammer-cli-foreman/pull/562)), [#30814](http://projects.theforeman.org/issues/30814)
|
|
23
|
+
* Drop puppetrun command from hammer ([PR #561](https://github.com/theforeman/hammer-cli-foreman/pull/561)), [#31806](http://projects.theforeman.org/issues/31806)
|
|
24
|
+
* Global registration module ([PR #558](https://github.com/theforeman/hammer-cli-foreman/pull/558)), [#31630](http://projects.theforeman.org/issues/31630)
|
|
25
|
+
* Add support for vnic profile ([PR #552](https://github.com/theforeman/hammer-cli-foreman/pull/552)), [#31493](http://projects.theforeman.org/issues/31493)
|
|
26
|
+
* Bump to 2.5.0-develop
|
|
27
|
+
* Bump to 2.4.0
|
|
28
|
+
* Correct descriptions for resources, [#31668](http://projects.theforeman.org/issues/31668)
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
### 2.4.0 (2021-02-01)
|
|
32
|
+
* Fix hammer list failure when defaults are set ([PR #551](https://github.com/theforeman/hammer-cli-foreman/pull/551)), [#31384](http://projects.theforeman.org/issues/31384)
|
|
7
33
|
* Deprecating puppetrun command ([PR #554](https://github.com/theforeman/hammer-cli-foreman/pull/554)), [#31536](http://projects.theforeman.org/issues/31536)
|
|
34
|
+
* Set new owner with host update ([PR #556](https://github.com/theforeman/hammer-cli-foreman/pull/556)), [#31609](http://projects.theforeman.org/issues/31609)
|
|
35
|
+
* Consume structured statuses api data ([PR #553](https://github.com/theforeman/hammer-cli-foreman/pull/553)), [#31570](http://projects.theforeman.org/issues/31570)
|
|
36
|
+
* Added missing tests to filter ([PR #549](https://github.com/theforeman/hammer-cli-foreman/pull/549)), [#31074](http://projects.theforeman.org/issues/31074')
|
|
37
|
+
* Bump to 2.4.0-develop
|
|
8
38
|
|
|
9
39
|
### 2.3.0 (2020-11-03)
|
|
10
40
|
* Hammer ping skip authentication ([PR #550](https://github.com/theforeman/hammer-cli-foreman/pull/550)), [#31140](http://projects.theforeman.org/issues/31140)
|
data/lib/hammer_cli_foreman.rb
CHANGED
|
@@ -60,15 +60,6 @@ module HammerCLIForeman
|
|
|
60
60
|
'HammerCLIForeman::Domain', 'hammer_cli_foreman/domain'
|
|
61
61
|
)
|
|
62
62
|
|
|
63
|
-
HammerCLI::MainCommand.lazy_subcommand('environment', _("Manipulate environments"),
|
|
64
|
-
'HammerCLIForeman::PuppetEnvironment', 'hammer_cli_foreman/puppet_environment',
|
|
65
|
-
:warning => _('%{env} command is deprecated and will be removed in one of the future versions. Please use %{puppet_env} command instead.') % {:env => 'environment', :puppet_env => 'puppet-environment'}
|
|
66
|
-
)
|
|
67
|
-
|
|
68
|
-
HammerCLI::MainCommand.lazy_subcommand('puppet-environment', _("Manipulate Puppet environments"),
|
|
69
|
-
'HammerCLIForeman::PuppetEnvironment', 'hammer_cli_foreman/puppet_environment'
|
|
70
|
-
)
|
|
71
|
-
|
|
72
63
|
HammerCLI::MainCommand.lazy_subcommand('fact', _("Search facts"),
|
|
73
64
|
'HammerCLIForeman::Fact', 'hammer_cli_foreman/fact'
|
|
74
65
|
)
|
|
@@ -113,10 +104,6 @@ module HammerCLIForeman
|
|
|
113
104
|
'HammerCLIForeman::PartitionTable', 'hammer_cli_foreman/partition_table'
|
|
114
105
|
)
|
|
115
106
|
|
|
116
|
-
HammerCLI::MainCommand.lazy_subcommand('puppet-class', _("Search puppet modules"),
|
|
117
|
-
'HammerCLIForeman::PuppetClass', 'hammer_cli_foreman/puppet_class'
|
|
118
|
-
)
|
|
119
|
-
|
|
120
107
|
HammerCLI::MainCommand.lazy_subcommand('report', _("Browse and read reports"),
|
|
121
108
|
'HammerCLIForeman::ConfigReport', 'hammer_cli_foreman/config_report',
|
|
122
109
|
:warning => _('%{report} command is deprecated and will be removed in one of the future versions. Please use %{config_report} command instead.') % {:report => 'report', :config_report => 'config-report'}
|
|
@@ -134,10 +121,6 @@ module HammerCLIForeman
|
|
|
134
121
|
'HammerCLIForeman::Role', 'hammer_cli_foreman/role'
|
|
135
122
|
)
|
|
136
123
|
|
|
137
|
-
HammerCLI::MainCommand.lazy_subcommand('sc-param', _("Manipulate smart class parameters"),
|
|
138
|
-
'HammerCLIForeman::SmartClassParameter', 'hammer_cli_foreman/smart_class_parameter'
|
|
139
|
-
)
|
|
140
|
-
|
|
141
124
|
HammerCLI::MainCommand.lazy_subcommand('proxy', _("Manipulate smart proxies"),
|
|
142
125
|
'HammerCLIForeman::SmartProxy', 'hammer_cli_foreman/smart_proxy'
|
|
143
126
|
)
|
|
@@ -166,10 +149,6 @@ module HammerCLIForeman
|
|
|
166
149
|
'HammerCLIForeman::Usergroup', 'hammer_cli_foreman/usergroup'
|
|
167
150
|
)
|
|
168
151
|
|
|
169
|
-
HammerCLI::MainCommand.lazy_subcommand('config-group', _("Manipulate config groups"),
|
|
170
|
-
'HammerCLIForeman::ConfigGroup', 'hammer_cli_foreman/config_group'
|
|
171
|
-
)
|
|
172
|
-
|
|
173
152
|
HammerCLI::MainCommand.lazy_subcommand('ping', _("Get the status of the server and/or it's subcomponents"),
|
|
174
153
|
'HammerCLIForeman::PingCommand', 'hammer_cli_foreman/ping'
|
|
175
154
|
)
|
|
@@ -184,6 +163,9 @@ module HammerCLIForeman
|
|
|
184
163
|
|
|
185
164
|
HammerCLI::MainCommand.lazy_subcommand('bookmark', _("Manage bookmarks"),
|
|
186
165
|
'HammerCLIForeman::Bookmark', 'hammer_cli_foreman/bookmark')
|
|
166
|
+
|
|
167
|
+
HammerCLI::MainCommand.lazy_subcommand('host-registration', _("Host Registration"),
|
|
168
|
+
'HammerCLIForeman::Registration', 'hammer_cli_foreman/registration')
|
|
187
169
|
rescue => e
|
|
188
170
|
handler = HammerCLIForeman::ExceptionHandler.new(:context => {}, :adapter => :base)
|
|
189
171
|
handler.handle_exception(e)
|
|
@@ -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
|
|
|
@@ -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
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
+
require 'hammer_cli_foreman/command_extensions/update_common'
|
|
1
2
|
require 'hammer_cli_foreman/command_extensions/fields'
|
|
2
|
-
require 'hammer_cli_foreman/command_extensions/puppet_environment'
|
|
3
|
-
require 'hammer_cli_foreman/command_extensions/puppet_environments'
|
|
4
3
|
require 'hammer_cli_foreman/command_extensions/option_sources'
|
|
5
4
|
require 'hammer_cli_foreman/command_extensions/hosts'
|
|
6
5
|
require 'hammer_cli_foreman/command_extensions/ping'
|
|
@@ -10,9 +10,28 @@ module HammerCLIForeman
|
|
|
10
10
|
end
|
|
11
11
|
end
|
|
12
12
|
|
|
13
|
+
def self.check_for_unrecognized(plugins, output_definition)
|
|
14
|
+
failed = plugins.select { |_, data| data['services'] }
|
|
15
|
+
.each_with_object([]) { |(_, d), s| s << d['services'] }
|
|
16
|
+
.reduce({}, :merge)
|
|
17
|
+
.select do |name, data|
|
|
18
|
+
begin
|
|
19
|
+
output_definition.find_field(name)
|
|
20
|
+
false
|
|
21
|
+
rescue ArgumentError
|
|
22
|
+
data['status'] == _('FAIL')
|
|
23
|
+
end
|
|
24
|
+
end
|
|
25
|
+
return if failed.empty?
|
|
26
|
+
|
|
27
|
+
warn [_('%{count} more service(s) failed, but not shown:') % { count: failed.size },
|
|
28
|
+
failed.keys.join(', '),
|
|
29
|
+
''].join("\n")
|
|
30
|
+
end
|
|
31
|
+
|
|
13
32
|
def self.failed?(services)
|
|
14
|
-
services
|
|
15
|
-
services['
|
|
33
|
+
services['foreman']['database']['active'] == 'FAIL' ||
|
|
34
|
+
services.each_value.any? { |s| s['status'] == _('FAIL') }
|
|
16
35
|
end
|
|
17
36
|
|
|
18
37
|
request_options do |options|
|
|
@@ -4,7 +4,7 @@ module HammerCLIForeman
|
|
|
4
4
|
before_print do |data|
|
|
5
5
|
return if data['results'].nil?
|
|
6
6
|
|
|
7
|
-
normalize_plugins(data['results']['foreman']['plugins'])
|
|
7
|
+
normalize_plugins(data['results']['foreman']['plugins']) if data['results']['foreman']['plugins'].any?(String)
|
|
8
8
|
data['results']['foreman']['smart_proxies'].each do |proxy|
|
|
9
9
|
proxy['features'] = normalize_features(proxy['features'])
|
|
10
10
|
proxy['failed_features'] = normalize_failed_features(proxy['failed_features'])
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module HammerCLIForeman
|
|
4
|
+
module CommandExtensions
|
|
5
|
+
class UpdateCommon < HammerCLI::CommandExtensions
|
|
6
|
+
inheritable true
|
|
7
|
+
|
|
8
|
+
request_params do |params, command_object|
|
|
9
|
+
update_params = params[command_object.resource.singular_name]
|
|
10
|
+
command_object.context[:action_message] = :nothing_to_do if update_params && update_params.empty?
|
|
11
|
+
end
|
|
12
|
+
end
|
|
13
|
+
end
|
|
14
|
+
end
|
|
@@ -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
|
|
@@ -294,7 +287,7 @@ module HammerCLIForeman
|
|
|
294
287
|
def help
|
|
295
288
|
return super unless resource
|
|
296
289
|
|
|
297
|
-
meta = resource.action(action).apidoc
|
|
290
|
+
meta = resource.action(action).apidoc&.dig(:metadata)
|
|
298
291
|
if meta && meta[:search] && respond_to?(:option_search)
|
|
299
292
|
self.class.extend_help do |h|
|
|
300
293
|
h.section(_('Search / Order fields'), id: :search_fields_section) do |h|
|
|
@@ -548,6 +541,19 @@ module HammerCLIForeman
|
|
|
548
541
|
builder
|
|
549
542
|
end
|
|
550
543
|
|
|
544
|
+
def self.inherited(child)
|
|
545
|
+
child.success_message_for(:nothing_to_do, _('Nothing to update.'))
|
|
546
|
+
end
|
|
547
|
+
|
|
548
|
+
def clean_up_context
|
|
549
|
+
super
|
|
550
|
+
context.delete(:action_message)
|
|
551
|
+
end
|
|
552
|
+
|
|
553
|
+
def success_message
|
|
554
|
+
success_message_for(context[:action_message] || :default)
|
|
555
|
+
end
|
|
556
|
+
|
|
551
557
|
def method_options_for_params(params, options)
|
|
552
558
|
opts = super
|
|
553
559
|
# overwrite searchables with correct values
|
|
@@ -560,6 +566,7 @@ module HammerCLIForeman
|
|
|
560
566
|
opts
|
|
561
567
|
end
|
|
562
568
|
|
|
569
|
+
extend_with(HammerCLIForeman::CommandExtensions::UpdateCommon.new)
|
|
563
570
|
end
|
|
564
571
|
|
|
565
572
|
|
|
@@ -104,6 +104,15 @@ module HammerCLIForeman
|
|
|
104
104
|
build_options
|
|
105
105
|
end
|
|
106
106
|
|
|
107
|
+
class AssociateVmsCommand < HammerCLIForeman::Command
|
|
108
|
+
action :associate
|
|
109
|
+
command_name 'associate-vms'
|
|
110
|
+
success_message _("Virtual machines have been associated.")
|
|
111
|
+
failure_message _("Could not associate the virtual machines")
|
|
112
|
+
|
|
113
|
+
build_options
|
|
114
|
+
end
|
|
115
|
+
|
|
107
116
|
class AvailableClustersCommand < HammerCLIForeman::ListCommand
|
|
108
117
|
action :available_clusters
|
|
109
118
|
command_name 'clusters'
|
|
@@ -128,6 +137,19 @@ module HammerCLIForeman
|
|
|
128
137
|
build_options
|
|
129
138
|
end
|
|
130
139
|
|
|
140
|
+
class AvailableVnicProfilesCommand < HammerCLIForeman::ListCommand
|
|
141
|
+
action :available_vnic_profiles
|
|
142
|
+
command_name 'vnic-profiles'
|
|
143
|
+
|
|
144
|
+
output do
|
|
145
|
+
field :id, _('VNIC profile ID'), Fields::Field, :max_width => 200, :hide_blank => true
|
|
146
|
+
field :name, _('Name')
|
|
147
|
+
field :network, _('Network ID')
|
|
148
|
+
end
|
|
149
|
+
|
|
150
|
+
build_options
|
|
151
|
+
end
|
|
152
|
+
|
|
131
153
|
class AvailableImagesCommand < HammerCLIForeman::ListCommand
|
|
132
154
|
action :available_images
|
|
133
155
|
command_name 'images'
|
|
@@ -28,7 +28,8 @@ module HammerCLIForeman
|
|
|
28
28
|
[
|
|
29
29
|
['compute_name', _('Compute name, e.g. eth0')],
|
|
30
30
|
['compute_network', _('Select one of available networks for a cluster, must be an ID or a name')],
|
|
31
|
-
['compute_interface', _('Interface type')]
|
|
31
|
+
['compute_interface', _('Interface type')],
|
|
32
|
+
['compute_vnic_profile', _('Vnic Profile')]
|
|
32
33
|
]
|
|
33
34
|
end
|
|
34
35
|
|
|
@@ -10,6 +10,7 @@ module HammerCLIForeman
|
|
|
10
10
|
field :id, _("Id")
|
|
11
11
|
field :host_name, _("Host")
|
|
12
12
|
field :reported_at, _("Last report"), Fields::Date
|
|
13
|
+
field :origin, _("Origin")
|
|
13
14
|
from "status" do
|
|
14
15
|
field :applied, _("Applied")
|
|
15
16
|
field :restarted, _("Restarted")
|
|
@@ -30,6 +31,7 @@ module HammerCLIForeman
|
|
|
30
31
|
field :id, _("Id")
|
|
31
32
|
field :host_name, _("Host")
|
|
32
33
|
field :reported_at, _("Reported at"), Fields::Date
|
|
34
|
+
field :origin, _("Origin")
|
|
33
35
|
label _("Report status") do
|
|
34
36
|
from "status" do
|
|
35
37
|
field :applied, _("Applied")
|
|
@@ -78,7 +78,7 @@ module HammerCLIForeman
|
|
|
78
78
|
class CreateCommand < HammerCLIForeman::CreateCommand
|
|
79
79
|
include TaxonomyCheck
|
|
80
80
|
|
|
81
|
-
success_message _("Permission filter for [%<
|
|
81
|
+
success_message _("Permission filter for [%<resource_type_label>s] created.")
|
|
82
82
|
failure_message _("Could not create the permission filter")
|
|
83
83
|
|
|
84
84
|
def validate_options
|
|
@@ -92,7 +92,7 @@ module HammerCLIForeman
|
|
|
92
92
|
class UpdateCommand < HammerCLIForeman::UpdateCommand
|
|
93
93
|
include TaxonomyCheck
|
|
94
94
|
|
|
95
|
-
success_message _("Permission filter for [%<
|
|
95
|
+
success_message _("Permission filter for [%<resource_type_label>s] updated.")
|
|
96
96
|
failure_message _("Could not update the permission filter")
|
|
97
97
|
|
|
98
98
|
def request_params
|
|
@@ -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,9 +54,6 @@ 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")
|
|
65
58
|
field :managed, _("Managed"), Fields::Boolean
|
|
66
59
|
|
|
@@ -171,18 +164,7 @@ module HammerCLIForeman
|
|
|
171
164
|
end
|
|
172
165
|
|
|
173
166
|
|
|
174
|
-
|
|
175
|
-
command_name "puppetrun"
|
|
176
|
-
resource :puppet_hosts
|
|
177
|
-
action :puppetrun
|
|
178
|
-
|
|
179
|
-
def execute
|
|
180
|
-
warn _('The puppetrun feature has been removed, however you can use the Remote Execution Plugin to run Puppet commands')
|
|
181
|
-
HammerCLI::EX_SOFTWARE
|
|
182
|
-
end
|
|
183
|
-
|
|
184
|
-
build_options
|
|
185
|
-
end
|
|
167
|
+
|
|
186
168
|
|
|
187
169
|
|
|
188
170
|
class FactsCommand < HammerCLIForeman::AssociatedResourceListCommand
|
|
@@ -202,23 +184,6 @@ module HammerCLIForeman
|
|
|
202
184
|
build_options
|
|
203
185
|
end
|
|
204
186
|
|
|
205
|
-
|
|
206
|
-
class PuppetClassesCommand < HammerCLIForeman::ListCommand
|
|
207
|
-
command_name "puppet-classes"
|
|
208
|
-
resource :puppetclasses
|
|
209
|
-
|
|
210
|
-
output HammerCLIForeman::PuppetClass::ListCommand.output_definition
|
|
211
|
-
|
|
212
|
-
def send_request
|
|
213
|
-
HammerCLIForeman::PuppetClass::ListCommand.unhash_classes(super)
|
|
214
|
-
end
|
|
215
|
-
|
|
216
|
-
build_options do |o|
|
|
217
|
-
o.without(:hostgroup_id, :environment_id)
|
|
218
|
-
o.expand.only(:hosts)
|
|
219
|
-
end
|
|
220
|
-
end
|
|
221
|
-
|
|
222
187
|
class ConfigReportsCommand < HammerCLIForeman::ListCommand
|
|
223
188
|
command_name 'config-reports'
|
|
224
189
|
resource :config_reports, :index
|
|
@@ -304,7 +269,6 @@ module HammerCLIForeman
|
|
|
304
269
|
end
|
|
305
270
|
end
|
|
306
271
|
|
|
307
|
-
extend_with(HammerCLIForeman::CommandExtensions::PuppetEnvironment.new)
|
|
308
272
|
extend_with(HammerCLIForeman::CommandExtensions::Hosts::Help::Interfaces.new)
|
|
309
273
|
extend_with(HammerCLIForeman::CommandExtensions::Hosts::Help::ComputeResources.custom(add_host_specific_attrs: true).new)
|
|
310
274
|
end
|
|
@@ -335,7 +299,6 @@ module HammerCLIForeman
|
|
|
335
299
|
sources
|
|
336
300
|
end
|
|
337
301
|
|
|
338
|
-
extend_with(HammerCLIForeman::CommandExtensions::PuppetEnvironment.new)
|
|
339
302
|
extend_with(HammerCLIForeman::CommandExtensions::Hosts::Help::Interfaces.new)
|
|
340
303
|
extend_with(HammerCLIForeman::CommandExtensions::Hosts::Help::ComputeResources.custom(add_host_specific_attrs: true).new)
|
|
341
304
|
end
|
|
@@ -468,15 +431,6 @@ module HammerCLIForeman
|
|
|
468
431
|
build_options without: [:power_action]
|
|
469
432
|
end
|
|
470
433
|
|
|
471
|
-
class SCParamsCommand < HammerCLIForeman::SmartClassParametersList
|
|
472
|
-
build_options_for :hosts
|
|
473
|
-
|
|
474
|
-
def validate_options
|
|
475
|
-
super
|
|
476
|
-
validator.any(:option_host_name, :option_host_id).required
|
|
477
|
-
end
|
|
478
|
-
end
|
|
479
|
-
|
|
480
434
|
class RebuildConfigCommand < HammerCLIForeman::SingleResourceCommand
|
|
481
435
|
action :rebuild_config
|
|
482
436
|
command_name "rebuild-config"
|