hammer_cli_foreman 2.1.2 → 2.4.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 +35 -4
- data/doc/testing.md +13 -0
- data/lib/hammer_cli_foreman.rb +0 -4
- data/lib/hammer_cli_foreman/architecture.rb +5 -5
- data/lib/hammer_cli_foreman/associating_commands.rb +4 -5
- data/lib/hammer_cli_foreman/auth.rb +4 -4
- data/lib/hammer_cli_foreman/bookmark.rb +6 -6
- data/lib/hammer_cli_foreman/command_extensions/ping.rb +10 -1
- data/lib/hammer_cli_foreman/command_extensions/status.rb +1 -1
- data/lib/hammer_cli_foreman/commands.rb +3 -1
- data/lib/hammer_cli_foreman/compute_profile.rb +5 -5
- data/lib/hammer_cli_foreman/compute_resource/ovirt.rb +1 -0
- data/lib/hammer_cli_foreman/config_group.rb +5 -5
- data/lib/hammer_cli_foreman/host.rb +3 -2
- data/lib/hammer_cli_foreman/hosts/common_update_options.rb +17 -10
- data/lib/hammer_cli_foreman/location.rb +2 -0
- 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 -9
- data/lib/hammer_cli_foreman/organization.rb +2 -0
- data/lib/hammer_cli_foreman/output/fields.rb +1 -1
- data/lib/hammer_cli_foreman/output/formatters.rb +1 -1
- data/lib/hammer_cli_foreman/ping.rb +20 -11
- data/lib/hammer_cli_foreman/references.rb +16 -0
- data/lib/hammer_cli_foreman/settings.rb +16 -2
- data/lib/hammer_cli_foreman/testing/api_expectations.rb +10 -0
- data/lib/hammer_cli_foreman/usergroup.rb +5 -5
- data/lib/hammer_cli_foreman/version.rb +1 -1
- data/lib/minitest/coverage_reporter.rb +94 -0
- data/lib/minitest/hammer_coverage_plugin.rb +19 -0
- 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/functional/architecture_test.rb +49 -0
- data/test/functional/audit_test.rb +86 -63
- data/test/functional/bookmark_test.rb +20 -0
- data/test/functional/commands/list_test.rb +11 -11
- data/test/functional/compute_profile_test.rb +47 -2
- data/test/functional/config_group_test.rb +50 -0
- data/test/functional/filter_test.rb +114 -47
- data/test/functional/host_test.rb +105 -19
- data/test/functional/location_test.rb +134 -0
- data/test/functional/mail_notification_test.rb +20 -0
- data/test/functional/media_test.rb +130 -0
- data/test/functional/model_test.rb +50 -0
- data/test/functional/operating_system_test.rb +51 -0
- data/test/functional/organization_test.rb +52 -0
- data/test/functional/realm_test.rb +103 -0
- data/test/functional/role_test.rb +9 -12
- data/test/functional/settings_test.rb +78 -1
- data/test/functional/status_test.rb +79 -13
- data/test/functional/user_test.rb +39 -0
- data/test/functional/usergroup_test.rb +51 -0
- data/test/test_helper.rb +5 -2
- data/test/unit/api/interactive_basic_auth_test.rb +3 -1
- data/test/unit/api/oauth/oauth_authentication_code_grant_test.rb +2 -2
- data/test/unit/api/oauth/oauth_password_grant_test.rb +2 -2
- data/test/unit/api_test.rb +3 -4
- data/test/unit/apipie_resource_mock.rb +25 -4
- data/test/unit/architecture_test.rb +10 -1
- data/test/unit/bookmark_test.rb +99 -0
- data/test/unit/commands_test.rb +19 -19
- data/test/unit/common_parameter_test.rb +1 -1
- data/test/unit/compute_profile_test.rb +87 -0
- data/test/unit/config_group_test.rb +10 -0
- data/test/unit/dependency_resolver_test.rb +4 -4
- data/test/unit/exception_handler_test.rb +13 -13
- data/test/unit/helpers/command.rb +5 -5
- data/test/unit/helpers/resource_disabled.rb +2 -2
- data/test/unit/host_test.rb +1 -24
- data/test/unit/id_resolver_test.rb +23 -23
- data/test/unit/mail_notification_test.rb +53 -0
- data/test/unit/media_test.rb +1 -1
- data/test/unit/model_test.rb +10 -0
- data/test/unit/operating_system_test.rb +14 -1
- data/test/unit/option_builders_test.rb +49 -49
- data/test/unit/option_sources/id_params_test.rb +2 -2
- data/test/unit/option_sources/ids_params_test.rb +2 -2
- data/test/unit/output/formatters_test.rb +21 -21
- data/test/unit/param_filters_test.rb +17 -17
- data/test/unit/partition_table_test.rb +2 -2
- data/test/unit/role_test.rb +2 -2
- data/test/unit/sessions_test.rb +24 -24
- data/test/unit/settings_test.rb +4 -0
- data/test/unit/template_test.rb +1 -1
- data/test/unit/usergroup_test.rb +10 -0
- metadata +26 -7
- data/lib/hammer_cli_foreman/trend.rb +0 -47
- data/test/functional/trend_test.rb +0 -22
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: efc47b1a544eaf1e63d7328b51210b5d0b4d153bb6ff35156a8e55b9527aa207
|
|
4
|
+
data.tar.gz: dd374b8958f6a171a43b6b6521ff6f9d919a85c0b5b5daf5d099a49c08b4c2ec
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: d8d2cd3f5b7232c92a2a6133b23592dca23556f7738de97b8dfc5553306332ec93fefd9e00970c139b630563b08563afc2bd5c1112f1177db34b904c61ebe99e
|
|
7
|
+
data.tar.gz: 67d74339e57bd0c0e61942ad4ff94d7399877db33e2a2e0f190a4ab6eec4bf8f6070bad6adb7624009c2ecbd0dd7ed54f8589c1438293efc9c62970af65a7845
|
data/doc/release_notes.md
CHANGED
|
@@ -1,15 +1,46 @@
|
|
|
1
1
|
Release notes
|
|
2
2
|
=============
|
|
3
|
-
|
|
3
|
+
|
|
4
|
+
### 2.4.0 (2021-02-01)
|
|
5
|
+
* 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)
|
|
6
|
+
* Deprecating puppetrun command ([PR #554](https://github.com/theforeman/hammer-cli-foreman/pull/554)), [#31536](http://projects.theforeman.org/issues/31536)
|
|
7
|
+
* Set new owner with host update ([PR #556](https://github.com/theforeman/hammer-cli-foreman/pull/556)), [#31609](http://projects.theforeman.org/issues/31609)
|
|
8
|
+
* Consume structured statuses api data ([PR #553](https://github.com/theforeman/hammer-cli-foreman/pull/553)), [#31570](http://projects.theforeman.org/issues/31570)
|
|
9
|
+
* Added missing tests to filter ([PR #549](https://github.com/theforeman/hammer-cli-foreman/pull/549)), [#31074](http://projects.theforeman.org/issues/31074')
|
|
10
|
+
* Bump to 2.4.0-develop
|
|
11
|
+
|
|
12
|
+
### 2.3.0 (2020-11-03)
|
|
13
|
+
* Hammer ping skip authentication ([PR #550](https://github.com/theforeman/hammer-cli-foreman/pull/550)), [#31140](http://projects.theforeman.org/issues/31140)
|
|
14
|
+
* Return non-zero exit code if services failed, [#30496](http://projects.theforeman.org/issues/30496)
|
|
15
|
+
* Better option assignment for nested params ([PR #544](https://github.com/theforeman/hammer-cli-foreman/pull/544)), [#30910](http://projects.theforeman.org/issues/30910)
|
|
16
|
+
* Use parent resource instead of hardcoded one, [#30938](http://projects.theforeman.org/issues/30938)
|
|
17
|
+
* Added missing tests to setting, [#30886](http://projects.theforeman.org/issues/30886)
|
|
18
|
+
* Added missing tests to installation medium test, [#30805](http://projects.theforeman.org/issues/30805)
|
|
19
|
+
* Added missing tests to location test, [#30829](http://projects.theforeman.org/issues/30829)
|
|
20
|
+
* Added missing tests to organization test, [#30794](http://projects.theforeman.org/issues/30794)
|
|
21
|
+
* Added missing tests to audit test ([PR #537](https://github.com/theforeman/hammer-cli-foreman/pull/537)), [#30740](http://projects.theforeman.org/issues/30740)
|
|
22
|
+
* Use underscores in `login oauth` option values ([PR #536](https://github.com/theforeman/hammer-cli-foreman/pull/536)), [#30720](http://projects.theforeman.org/issues/30720)
|
|
23
|
+
* Drop trends from hammer-cli-foreman ([PR #535](https://github.com/theforeman/hammer-cli-foreman/pull/535)), [#30134](http://projects.theforeman.org/issues/30134)
|
|
24
|
+
* Added highly available option to ovirt ([PR #532](https://github.com/theforeman/hammer-cli-foreman/pull/532)), [#30494](http://projects.theforeman.org/issues/30494)
|
|
25
|
+
* Add ptables and realms to location and organization info ([PR #534](https://github.com/theforeman/hammer-cli-foreman/pull/534)), [#30663](http://projects.theforeman.org/issues/30663)
|
|
26
|
+
* Bump to 2.3.0-develop
|
|
27
|
+
* Bump to 2.2.0
|
|
28
|
+
* Added missing tests to user test, [#30593](http://projects.theforeman.org/issues/30593)
|
|
29
|
+
|
|
30
|
+
### 2.2.0 (2020-08-11)
|
|
4
31
|
* Change config templates to provisioning templates ([PR #531](https://github.com/theforeman/hammer-cli-foreman/pull/531)), [#29971](http://projects.theforeman.org/issues/29971)
|
|
32
|
+
* Fix minitest deprecation ([PR #523](https://github.com/theforeman/hammer-cli-foreman/pull/523))
|
|
33
|
+
* Add a coverage test ([PR #522](https://github.com/theforeman/hammer-cli-foreman/pull/522))
|
|
5
34
|
* Return 'set current context for request' to help ([PR #530](https://github.com/theforeman/hammer-cli-foreman/pull/530)), [#30182](http://projects.theforeman.org/issues/30182)
|
|
6
|
-
* Display request uuid for audit ([PR #528](https://github.com/theforeman/hammer-cli-foreman/pull/528))
|
|
7
|
-
|
|
8
|
-
|
|
35
|
+
* Display request uuid for audit ([PR #528](https://github.com/theforeman/hammer-cli-foreman/pull/528)), [#30130](http://projects.theforeman.org/issues/30130)
|
|
36
|
+
* Use parent resource instead of hardcoded one ([PR #527](https://github.com/theforeman/hammer-cli-foreman/pull/527)), [#30125](http://projects.theforeman.org/issues/30125)
|
|
37
|
+
* Added missing tests to realm command ([PR #526](https://github.com/theforeman/hammer-cli-foreman/pull/526)), [#30096](http://projects.theforeman.org/issues/30096)
|
|
38
|
+
* Added missing tests to trend test ([PR #525](https://github.com/theforeman/hammer-cli-foreman/pull/525)), [#30070](http://projects.theforeman.org/issues/30070)
|
|
9
39
|
* Revert "skip one test on ruby 2.7" ([PR #520](https://github.com/theforeman/hammer-cli-foreman/pull/520)), [#28601](http://projects.theforeman.org/issues/28601)
|
|
10
40
|
* Eliminate auth_type from sessions file ([PR #521](https://github.com/theforeman/hammer-cli-foreman/pull/521)), [#29876](http://projects.theforeman.org/issues/29876)
|
|
11
41
|
* Add disable option for user ([PR #497](https://github.com/theforeman/hammer-cli-foreman/pull/497)), [#28973](http://projects.theforeman.org/issues/28973)
|
|
12
42
|
* Added manage command to user mail notifications ([PR #513](https://github.com/theforeman/hammer-cli-foreman/pull/513)), [#7665](http://projects.theforeman.org/issues/7665)
|
|
43
|
+
* Bump to 2.2.0-develop
|
|
13
44
|
|
|
14
45
|
### 2.1.0 (2020-05-14)
|
|
15
46
|
* Bump hammer_cli to 2.1.0 ([PR #519](https://github.com/theforeman/hammer-cli-foreman/pull/519))
|
data/doc/testing.md
CHANGED
|
@@ -131,3 +131,16 @@ connection = api_connection
|
|
|
131
131
|
api = APIExpectationsDecorator.new(connection.api)
|
|
132
132
|
api.expects_search(:users, 'login=admin')
|
|
133
133
|
```
|
|
134
|
+
## Checking the coverage against the API
|
|
135
|
+
You can check how many API endpoints are covered by Hammer, this test runs all hammer tests,
|
|
136
|
+
and check which API actions run, therefore there could be two reasons for an endpoint to not be covered:
|
|
137
|
+
1. there is no test for this action
|
|
138
|
+
2. there is no hammer command for the API endpoint.
|
|
139
|
+
### running the coverage test
|
|
140
|
+
```bash
|
|
141
|
+
|
|
142
|
+
rake test TESTOPTS="-c"
|
|
143
|
+
|
|
144
|
+
TEST_API_VERSION=2.0 rake test TESTOPTS="-c"
|
|
145
|
+
|
|
146
|
+
```
|
data/lib/hammer_cli_foreman.rb
CHANGED
|
@@ -178,10 +178,6 @@ module HammerCLIForeman
|
|
|
178
178
|
'HammerCLIForeman::StatusCommand', 'hammer_cli_foreman/status'
|
|
179
179
|
)
|
|
180
180
|
|
|
181
|
-
HammerCLI::MainCommand.lazy_subcommand('trend', _("Manage trends"),
|
|
182
|
-
'HammerCLIForeman::Trend', 'hammer_cli_foreman/trend'
|
|
183
|
-
)
|
|
184
|
-
|
|
185
181
|
HammerCLI::MainCommand.lazy_subcommand('mail-notification', _("Manage mail notifications"),
|
|
186
182
|
'HammerCLIForeman::MailNotification', 'hammer_cli_foreman/mail_notification'
|
|
187
183
|
)
|
|
@@ -11,7 +11,7 @@ module HammerCLIForeman
|
|
|
11
11
|
field :name, _("Name")
|
|
12
12
|
end
|
|
13
13
|
|
|
14
|
-
build_options
|
|
14
|
+
build_options expand: { except: %i[organizations locations] }, without: %i[organization_id location_id]
|
|
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 expand: { except: %i[organizations locations] }, without: %i[organization_id location_id]
|
|
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 expand: { except: %i[organizations locations] }, without: %i[organization_id location_id]
|
|
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 expand: { except: %i[organizations locations] }, without: %i[organization_id location_id]
|
|
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 expand: { except: %i[organizations locations] }, without: %i[organization_id location_id]
|
|
51
51
|
end
|
|
52
52
|
|
|
53
53
|
HammerCLIForeman::AssociatingCommands::OperatingSystem.extend_command(self)
|
|
@@ -244,8 +244,7 @@ module HammerCLIForeman
|
|
|
244
244
|
|
|
245
245
|
def request_params
|
|
246
246
|
params = super
|
|
247
|
-
|
|
248
|
-
template_ids = params['operatingsystem']['provisioning_template_ids']
|
|
247
|
+
template_ids = params[resource.singular_name]['provisioning_template_ids']
|
|
249
248
|
if options['option_provisioning_template_search']
|
|
250
249
|
templates = HammerCLIForeman.collection_to_common_format(
|
|
251
250
|
associated_resource.call(
|
|
@@ -259,7 +258,7 @@ module HammerCLIForeman
|
|
|
259
258
|
template_ids << template_id.to_s
|
|
260
259
|
end
|
|
261
260
|
end
|
|
262
|
-
params[
|
|
261
|
+
params[resource.singular_name]['provisioning_template_ids'] = template_ids.uniq
|
|
263
262
|
params
|
|
264
263
|
end
|
|
265
264
|
|
|
@@ -281,7 +280,7 @@ module HammerCLIForeman
|
|
|
281
280
|
def request_params
|
|
282
281
|
params = super
|
|
283
282
|
|
|
284
|
-
template_ids = params[
|
|
283
|
+
template_ids = params[resource.singular_name]['provisioning_template_ids']
|
|
285
284
|
if options['option_provisioning_template_search']
|
|
286
285
|
templates = HammerCLIForeman.collection_to_common_format(
|
|
287
286
|
associated_resource.call(
|
|
@@ -295,7 +294,7 @@ module HammerCLIForeman
|
|
|
295
294
|
template_ids.delete(template_id.to_s)
|
|
296
295
|
end
|
|
297
296
|
end
|
|
298
|
-
params[
|
|
297
|
+
params[resource.singular_name]['provisioning_template_ids'] = template_ids.uniq
|
|
299
298
|
params
|
|
300
299
|
end
|
|
301
300
|
|
|
@@ -36,11 +36,11 @@ module HammerCLIForeman
|
|
|
36
36
|
|
|
37
37
|
option ["-u", "--username"], "USERNAME", _("Username to access the remote system")
|
|
38
38
|
option ["-p", "--password"], "PASSWORD", _("Password to access the remote system")
|
|
39
|
-
option ["-t", "--oidc-token-endpoint"], "
|
|
40
|
-
option ["-a", "--oidc-authorization-endpoint"], "
|
|
41
|
-
option ["-c", "--oidc-client-id"], "
|
|
39
|
+
option ["-t", "--oidc-token-endpoint"], "OPENIDC_TOKEN_ENDPOINT", _("Openidc provider URL which issues access token")
|
|
40
|
+
option ["-a", "--oidc-authorization-endpoint"], "OPENIDC_AUTHORIZATION_ENDPOINT", _("Openidc provider URL which issues authentication code (two factor only)")
|
|
41
|
+
option ["-c", "--oidc-client-id"], "OPENIDC_CLIENT_ID", _("Client id used in the Openidc provider")
|
|
42
42
|
option ["-f", "--two-factor"], :flag, _("Authenticate with two factor")
|
|
43
|
-
option ["-r", "--oidc-redirect-uri"], "
|
|
43
|
+
option ["-r", "--oidc-redirect-uri"], "OPENIDC_REDIRECT_URI", _("Redirect URI for the authentication code grant flow")
|
|
44
44
|
|
|
45
45
|
def execute
|
|
46
46
|
if option_two_factor?
|
|
@@ -15,34 +15,34 @@ module HammerCLIForeman
|
|
|
15
15
|
field :owner_type, _('Owner Type')
|
|
16
16
|
end
|
|
17
17
|
|
|
18
|
-
build_options
|
|
18
|
+
build_options expand: { except: %i[organizations locations] }, without: %i[organization_id location_id]
|
|
19
19
|
end
|
|
20
20
|
|
|
21
21
|
class InfoCommand < HammerCLIForeman::InfoCommand
|
|
22
22
|
output ListCommand.output_definition
|
|
23
|
-
|
|
24
|
-
build_options
|
|
23
|
+
|
|
24
|
+
build_options expand: { except: %i[organizations locations] }, without: %i[organization_id location_id]
|
|
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 expand: { except: %i[organizations locations] }, without: %i[organization_id location_id]
|
|
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 expand: { except: %i[organizations locations] }, without: %i[organization_id location_id]
|
|
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 expand: { except: %i[organizations locations] }, without: %i[organization_id location_id]
|
|
46
46
|
end
|
|
47
47
|
|
|
48
48
|
autoload_subcommands
|
|
@@ -6,9 +6,18 @@ module HammerCLIForeman
|
|
|
6
6
|
status = data['results']['foreman']['database']['active']
|
|
7
7
|
data['results']['foreman']['database']['active'] = status ? 'ok' : 'FAIL'
|
|
8
8
|
duration = data['results']['foreman']['database']['duration_ms']
|
|
9
|
-
data['results']['foreman']['database']['duration_ms'] = _(
|
|
9
|
+
data['results']['foreman']['database']['duration_ms'] = _('Duration: %sms') % duration
|
|
10
10
|
end
|
|
11
11
|
end
|
|
12
|
+
|
|
13
|
+
def self.failed?(services)
|
|
14
|
+
services.each_value.any? { |s| s['status'] == _('FAIL') } ||
|
|
15
|
+
services['foreman']['database']['active'] == 'FAIL'
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
request_options do |options|
|
|
19
|
+
options[:with_authentication] = false
|
|
20
|
+
end
|
|
12
21
|
end
|
|
13
22
|
end
|
|
14
23
|
end
|
|
@@ -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'])
|
|
@@ -548,10 +548,12 @@ module HammerCLIForeman
|
|
|
548
548
|
builder
|
|
549
549
|
end
|
|
550
550
|
|
|
551
|
-
def method_options_for_params(params,
|
|
551
|
+
def method_options_for_params(params, options)
|
|
552
552
|
opts = super
|
|
553
553
|
# overwrite searchables with correct values
|
|
554
554
|
searchables.for(resource).each do |s|
|
|
555
|
+
next unless params.map(&:name).include?(s.name)
|
|
556
|
+
|
|
555
557
|
new_value = get_option_value("new_#{s.name}")
|
|
556
558
|
opts[s.name] = new_value unless new_value.nil?
|
|
557
559
|
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 expand: { except: %i[organizations locations] }, without: %i[organization_id location_id]
|
|
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 expand: { except: %i[organizations locations] }, without: %i[organization_id location_id]
|
|
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 expand: { except: %i[organizations locations] }, without: %i[organization_id location_id]
|
|
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 expand: { except: %i[organizations locations] }, without: %i[organization_id location_id]
|
|
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 expand: { except: %i[organizations locations] }, without: %i[organization_id location_id]
|
|
53
53
|
end
|
|
54
54
|
|
|
55
55
|
lazy_subcommand('values', _("Create update and delete Compute profile values"),
|
|
@@ -12,6 +12,7 @@ module HammerCLIForeman
|
|
|
12
12
|
['cores', _('Integer value, number of cores')],
|
|
13
13
|
['sockets', _('Integer value, number of sockets')],
|
|
14
14
|
['memory', _('Amount of memory, integer value in bytes')],
|
|
15
|
+
['ha', _('Boolean, set 1 to high availability')],
|
|
15
16
|
['display_type', _('Possible values: %s') % 'VNC, SPICE'],
|
|
16
17
|
['keyboard_layout', _('Possible values: %s. Not usable if display type is SPICE.') % 'ar, de-ch, es, fo, fr-ca, hu, ja, mk, no, pt-br, sv, da, en-gb, et, fr, fr-ch, is, lt, nl, pl, ru, th, de, en-us, fi, fr-be, hr, it, lv, nl-be, pt, sl, tr']
|
|
17
18
|
]
|
|
@@ -8,7 +8,7 @@ module HammerCLIForeman
|
|
|
8
8
|
field :name, _("Name")
|
|
9
9
|
end
|
|
10
10
|
|
|
11
|
-
build_options
|
|
11
|
+
build_options expand: { except: %i[organizations locations] }, without: %i[organization_id location_id]
|
|
12
12
|
end
|
|
13
13
|
|
|
14
14
|
class InfoCommand < HammerCLIForeman::InfoCommand
|
|
@@ -16,28 +16,28 @@ module HammerCLIForeman
|
|
|
16
16
|
HammerCLIForeman::References.puppetclasses(self)
|
|
17
17
|
end
|
|
18
18
|
|
|
19
|
-
build_options
|
|
19
|
+
build_options expand: { except: %i[organizations locations] }, without: %i[organization_id location_id]
|
|
20
20
|
end
|
|
21
21
|
|
|
22
22
|
class CreateCommand < HammerCLIForeman::CreateCommand
|
|
23
23
|
success_message _("Config group created.")
|
|
24
24
|
failure_message _("Could not create the config group")
|
|
25
25
|
|
|
26
|
-
build_options
|
|
26
|
+
build_options expand: { except: %i[organizations locations] }, without: %i[organization_id location_id]
|
|
27
27
|
end
|
|
28
28
|
|
|
29
29
|
class UpdateCommand < HammerCLIForeman::UpdateCommand
|
|
30
30
|
success_message _("Config group updated.")
|
|
31
31
|
failure_message _("Could not update the config group")
|
|
32
32
|
|
|
33
|
-
build_options
|
|
33
|
+
build_options expand: { except: %i[organizations locations] }, without: %i[organization_id location_id]
|
|
34
34
|
end
|
|
35
35
|
|
|
36
36
|
class DeleteCommand < HammerCLIForeman::DeleteCommand
|
|
37
37
|
success_message _("Config group has been deleted.")
|
|
38
38
|
failure_message _("Could not delete the config group")
|
|
39
39
|
|
|
40
|
-
build_options
|
|
40
|
+
build_options expand: { except: %i[organizations locations] }, without: %i[organization_id location_id]
|
|
41
41
|
end
|
|
42
42
|
|
|
43
43
|
autoload_subcommands
|
|
@@ -176,8 +176,9 @@ module HammerCLIForeman
|
|
|
176
176
|
resource :puppet_hosts
|
|
177
177
|
action :puppetrun
|
|
178
178
|
|
|
179
|
-
def
|
|
180
|
-
|
|
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
|
|
181
182
|
end
|
|
182
183
|
|
|
183
184
|
build_options
|
|
@@ -6,7 +6,7 @@ module HammerCLIForeman
|
|
|
6
6
|
base.option "--owner", "OWNER_LOGIN", _("Login of the owner"),
|
|
7
7
|
:attribute_name => :option_user_login
|
|
8
8
|
base.option "--owner-id", "OWNER_ID", _("ID of the owner"),
|
|
9
|
-
:attribute_name => :
|
|
9
|
+
:attribute_name => :option_owner_id
|
|
10
10
|
|
|
11
11
|
base.option "--root-password", "ROOT_PW",
|
|
12
12
|
_("Required if host is managed and value is not inherited from host group or default password in settings")
|
|
@@ -84,18 +84,16 @@ module HammerCLIForeman
|
|
|
84
84
|
|
|
85
85
|
params['host']['host_parameters_attributes'] = parameter_attributes unless option_parameters.nil?
|
|
86
86
|
params['host']['host_parameters_attributes'] ||= option_typed_parameters unless option_typed_parameters.nil?
|
|
87
|
-
params['host']['compute_attributes'] = option_compute_attributes || {}
|
|
88
87
|
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
compute_attributes['display']['keyboard_layout'] = compute_attributes['keyboard_layout'] unless compute_attributes['keyboard_layout'].nil?
|
|
93
|
-
compute_attributes.delete('display_type')
|
|
94
|
-
compute_attributes.delete('keyboard_layout')
|
|
95
|
-
params['host']['compute_attributes'] = compute_attributes
|
|
88
|
+
if option_compute_attributes && !option_compute_attributes.empty?
|
|
89
|
+
params['host']['compute_attributes'] = host_compute_attrs(option_compute_attributes)
|
|
90
|
+
end
|
|
96
91
|
|
|
97
92
|
if action == :update
|
|
98
|
-
|
|
93
|
+
unless option_volume_list.empty?
|
|
94
|
+
params['host']['compute_attributes'] ||= {}
|
|
95
|
+
params['host']['compute_attributes']['volumes_attributes'] = nested_attributes(option_volume_list)
|
|
96
|
+
end
|
|
99
97
|
params['host']['interfaces_attributes'] = interfaces_attributes unless option_interface_list.empty?
|
|
100
98
|
if options['option_new_location_id']
|
|
101
99
|
params['host']['location_id'] = options['option_new_location_id']
|
|
@@ -108,6 +106,7 @@ module HammerCLIForeman
|
|
|
108
106
|
params['host'].delete('organization_id')
|
|
109
107
|
end
|
|
110
108
|
else
|
|
109
|
+
params['host']['compute_attributes'] ||= {}
|
|
111
110
|
params['host']['compute_attributes']['volumes_attributes'] = nested_attributes(option_volume_list)
|
|
112
111
|
params['host']['interfaces_attributes'] = interfaces_attributes
|
|
113
112
|
end
|
|
@@ -121,6 +120,7 @@ module HammerCLIForeman
|
|
|
121
120
|
end
|
|
122
121
|
raise ArgumentError, "Missing argument for 'compute_resource'" if compute_resource_id.nil?
|
|
123
122
|
image_uuid = ::HammerCLIForeman::ComputeResources.get_image_uuid(compute_resource_id, options["option_image_id"])
|
|
123
|
+
params['host']['compute_attributes'] ||= {}
|
|
124
124
|
params['host']['compute_attributes']['image_id'] = image_uuid
|
|
125
125
|
end
|
|
126
126
|
params['host']['root_pass'] = option_root_password unless option_root_password.nil?
|
|
@@ -164,6 +164,13 @@ module HammerCLIForeman
|
|
|
164
164
|
end
|
|
165
165
|
end
|
|
166
166
|
|
|
167
|
+
def host_compute_attrs(attrs)
|
|
168
|
+
attrs['display'] = {} unless attrs['display_type'].nil? && attrs['keyboard_layout'].nil?
|
|
169
|
+
attrs['display']['type'] = attrs.delete('display_type') unless attrs['display_type'].nil?
|
|
170
|
+
attrs['display']['keyboard_layout'] = attrs.delete('keyboard_layout') unless attrs['keyboard_layout'].nil?
|
|
171
|
+
attrs
|
|
172
|
+
end
|
|
173
|
+
|
|
167
174
|
def nested_attributes(attrs)
|
|
168
175
|
return {} unless attrs
|
|
169
176
|
|