hammer_cli_foreman 2.5.2 → 3.0.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 +10 -4
- 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.rb +0 -2
- data/lib/hammer_cli_foreman/commands.rb +2 -9
- data/lib/hammer_cli_foreman/compute_profile.rb +5 -5
- data/lib/hammer_cli_foreman/host.rb +0 -35
- data/lib/hammer_cli_foreman/hostgroup.rb +2 -53
- data/lib/hammer_cli_foreman/hosts/common_update_options.rb +1 -23
- data/lib/hammer_cli_foreman/id_resolver.rb +0 -61
- 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_sources/id_params.rb +27 -10
- data/lib/hammer_cli_foreman/option_sources/ids_params.rb +25 -6
- 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 +0 -52
- 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/functional/architecture_test.rb +6 -4
- data/test/functional/bookmark_test.rb +3 -1
- data/test/functional/compute_profile_test.rb +3 -1
- data/test/functional/host_test.rb +0 -1
- data/test/functional/hostgroup/create_test.rb +0 -117
- data/test/functional/hostgroup/update_test.rb +0 -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/settings_test.rb +4 -4
- data/test/functional/template_test.rb +4 -37
- data/test/functional/usergroup_test.rb +3 -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/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_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 -4
- data/test/unit/smart_proxy_test.rb +0 -12
- data/test/unit/usergroup_test.rb +10 -10
- metadata +27 -48
- 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: 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,16 @@
|
|
1
1
|
Release notes
|
2
2
|
=============
|
3
|
-
###
|
4
|
-
*
|
5
|
-
|
6
|
-
|
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)
|
7
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
|
8
14
|
|
9
15
|
### 2.5.0 (2021-05-04)
|
10
16
|
* 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
|
@@ -1,7 +1,5 @@
|
|
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'
|
@@ -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|
|
@@ -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"),
|
@@ -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
|
|
@@ -191,23 +184,6 @@ module HammerCLIForeman
|
|
191
184
|
build_options
|
192
185
|
end
|
193
186
|
|
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
187
|
class ConfigReportsCommand < HammerCLIForeman::ListCommand
|
212
188
|
command_name 'config-reports'
|
213
189
|
resource :config_reports, :index
|
@@ -293,7 +269,6 @@ module HammerCLIForeman
|
|
293
269
|
end
|
294
270
|
end
|
295
271
|
|
296
|
-
extend_with(HammerCLIForeman::CommandExtensions::PuppetEnvironment.new)
|
297
272
|
extend_with(HammerCLIForeman::CommandExtensions::Hosts::Help::Interfaces.new)
|
298
273
|
extend_with(HammerCLIForeman::CommandExtensions::Hosts::Help::ComputeResources.custom(add_host_specific_attrs: true).new)
|
299
274
|
end
|
@@ -324,7 +299,6 @@ module HammerCLIForeman
|
|
324
299
|
sources
|
325
300
|
end
|
326
301
|
|
327
|
-
extend_with(HammerCLIForeman::CommandExtensions::PuppetEnvironment.new)
|
328
302
|
extend_with(HammerCLIForeman::CommandExtensions::Hosts::Help::Interfaces.new)
|
329
303
|
extend_with(HammerCLIForeman::CommandExtensions::Hosts::Help::ComputeResources.custom(add_host_specific_attrs: true).new)
|
330
304
|
end
|
@@ -457,15 +431,6 @@ module HammerCLIForeman
|
|
457
431
|
build_options without: [:power_action]
|
458
432
|
end
|
459
433
|
|
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
434
|
class RebuildConfigCommand < HammerCLIForeman::SingleResourceCommand
|
470
435
|
action :rebuild_config
|
471
436
|
command_name "rebuild-config"
|
@@ -1,25 +1,12 @@
|
|
1
|
-
require 'hammer_cli_foreman/smart_class_parameter'
|
2
|
-
require 'hammer_cli_foreman/puppet_class'
|
3
|
-
|
4
1
|
module HammerCLIForeman
|
5
2
|
|
6
3
|
module HostgroupUpdateCreateCommons
|
7
4
|
|
8
5
|
def self.included(base)
|
9
|
-
base.option "--puppet-class-ids", "PUPPETCLASS_IDS", _("List of puppetclass ids"),
|
10
|
-
:format => HammerCLI::Options::Normalizers::List.new,
|
11
|
-
:attribute_name => :option_puppetclass_ids
|
12
|
-
base.option "--puppet-classes", "PUPPET_CLASS_NAMES", "",
|
13
|
-
:format => HammerCLI::Options::Normalizers::List.new,
|
14
|
-
:attribute_name => :option_puppetclass_names
|
15
|
-
base.option "--puppet-ca-proxy", "PUPPET_CA_PROXY_NAME", _("Name of puppet CA proxy")
|
16
|
-
base.option "--puppet-proxy", "PUPPET_PROXY_NAME", _("Name of puppet proxy")
|
17
6
|
base.option "--parent", "PARENT_NAME", _("Name of parent hostgroup")
|
18
|
-
base.option ["--root-password"
|
19
|
-
deprecated: { '--root-pass' => _("Use --root-password instead") }
|
7
|
+
base.option ["--root-password"], "ROOT_PASSWORD", _("Root password")
|
20
8
|
base.option ["--ask-root-password", "--ask-root-pass"], "ASK_ROOT_PW", "",
|
21
|
-
format: HammerCLI::Options::Normalizers::Bool.new
|
22
|
-
deprecated: { '--ask-root-pass' => _("Use --ask-root-password instead") }
|
9
|
+
format: HammerCLI::Options::Normalizers::Bool.new
|
23
10
|
base.option "--subnet6", "SUBNET6_NAME", _("Subnet IPv6 name")
|
24
11
|
|
25
12
|
base.build_options without: %i[root_pass]
|
@@ -33,8 +20,6 @@ module HammerCLIForeman
|
|
33
20
|
def request_params
|
34
21
|
params = super
|
35
22
|
params['hostgroup']["parent_id"] ||= resolver.hostgroup_id('option_name' => option_parent) if option_parent
|
36
|
-
params['hostgroup']["puppet_proxy_id"] ||= proxy_id(option_puppet_proxy) if option_puppet_proxy
|
37
|
-
params['hostgroup']["puppet_ca_proxy_id"] ||= proxy_id(option_puppet_ca_proxy) if option_puppet_ca_proxy
|
38
23
|
|
39
24
|
params['hostgroup']['root_pass'] = option_root_password if option_root_password
|
40
25
|
params['hostgroup']['root_pass'] = HammerCLIForeman::HostgroupUpdateCreateCommons::ask_password if option_ask_root_password
|
@@ -61,7 +46,6 @@ module HammerCLIForeman
|
|
61
46
|
field :name, _("Name")
|
62
47
|
field :title, _("Title")
|
63
48
|
field nil, _("Operating System"), Fields::SingleReference, :key => :operatingsystem
|
64
|
-
field nil, _("Puppet Environment"), Fields::SingleReference, :key => :environment
|
65
49
|
field nil, _("Model"), Fields::SingleReference, :key => :model
|
66
50
|
end
|
67
51
|
|
@@ -75,13 +59,10 @@ module HammerCLIForeman
|
|
75
59
|
field :id, _("Id")
|
76
60
|
field :name, _("Name")
|
77
61
|
field :title, _("Title")
|
78
|
-
field nil, _("Puppet Environment"), Fields::SingleReference, :key => :environment
|
79
62
|
field nil, _("Model"), Fields::SingleReference, :key => :model
|
80
63
|
|
81
64
|
field :description, _("Description"), Fields::LongText, :hide_blank => true
|
82
65
|
field nil, _("Parent"), Fields::SingleReference, :key => :parent, :hide_blank => true
|
83
|
-
field nil, _("Puppet CA Proxy"), Fields::SingleReference, :key => :puppet_ca_proxy
|
84
|
-
field nil, _("Puppet Master Proxy"), Fields::SingleReference, :key => :puppet_proxy
|
85
66
|
field nil, _("Compute Profile"), Fields::SingleReference, :key => :compute_profile
|
86
67
|
field nil, _("Compute Resource"), Fields::SingleReference, :key => :compute_resource
|
87
68
|
label _('Network') do
|
@@ -97,7 +78,6 @@ module HammerCLIForeman
|
|
97
78
|
field nil, _("Partition Table"), Fields::SingleReference, :key => :ptable
|
98
79
|
field :pxe_loader, _("PXE Loader"), Fields::Field, :hide_blank => true
|
99
80
|
end
|
100
|
-
HammerCLIForeman::References.puppetclasses(self)
|
101
81
|
HammerCLIForeman::References.parameters(self)
|
102
82
|
HammerCLIForeman::References.taxonomies(self)
|
103
83
|
end
|
@@ -111,8 +91,6 @@ module HammerCLIForeman
|
|
111
91
|
|
112
92
|
success_message _("Hostgroup created.")
|
113
93
|
failure_message _("Could not create the hostgroup")
|
114
|
-
|
115
|
-
extend_with(HammerCLIForeman::CommandExtensions::PuppetEnvironment.new)
|
116
94
|
end
|
117
95
|
|
118
96
|
|
@@ -121,8 +99,6 @@ module HammerCLIForeman
|
|
121
99
|
|
122
100
|
success_message _("Hostgroup updated.")
|
123
101
|
failure_message _("Could not update the hostgroup")
|
124
|
-
|
125
|
-
extend_with(HammerCLIForeman::CommandExtensions::PuppetEnvironment.new)
|
126
102
|
end
|
127
103
|
|
128
104
|
|
@@ -133,24 +109,6 @@ module HammerCLIForeman
|
|
133
109
|
build_options
|
134
110
|
end
|
135
111
|
|
136
|
-
|
137
|
-
class PuppetClassesCommand < HammerCLIForeman::ListCommand
|
138
|
-
command_name "puppet-classes"
|
139
|
-
resource :puppetclasses
|
140
|
-
|
141
|
-
output HammerCLIForeman::PuppetClass::ListCommand.output_definition
|
142
|
-
|
143
|
-
def send_request
|
144
|
-
HammerCLIForeman::PuppetClass::ListCommand.unhash_classes(super)
|
145
|
-
end
|
146
|
-
|
147
|
-
build_options do |o|
|
148
|
-
o.without(:host_id, :environment_id)
|
149
|
-
o.expand.only(:hostgroups)
|
150
|
-
end
|
151
|
-
end
|
152
|
-
|
153
|
-
|
154
112
|
class SetParameterCommand < HammerCLIForeman::Parameter::SetCommand
|
155
113
|
desc _("Create or update parameter for a hostgroup")
|
156
114
|
|
@@ -170,15 +128,6 @@ module HammerCLIForeman
|
|
170
128
|
build_options
|
171
129
|
end
|
172
130
|
|
173
|
-
class SCParamsCommand < HammerCLIForeman::SmartClassParametersList
|
174
|
-
build_options_for :hostgroups
|
175
|
-
|
176
|
-
def validate_options
|
177
|
-
super
|
178
|
-
validator.any(:option_hostgroup_name, :option_hostgroup_id).required
|
179
|
-
end
|
180
|
-
end
|
181
|
-
|
182
131
|
class RebuildConfigCommand < HammerCLIForeman::SingleResourceCommand
|
183
132
|
action :rebuild_config
|
184
133
|
command_name "rebuild-config"
|
@@ -14,22 +14,6 @@ module HammerCLIForeman
|
|
14
14
|
base.option "--ask-root-password", "ASK_ROOT_PW", " ",
|
15
15
|
:format => HammerCLI::Options::Normalizers::Bool.new
|
16
16
|
|
17
|
-
base.option '--puppet-proxy', 'PUPPET_PROXY_NAME', '',
|
18
|
-
referenced_resource: 'puppet_proxy',
|
19
|
-
aliased_resource: 'puppet_proxy'
|
20
|
-
base.option '--puppet-ca-proxy', 'PUPPET_CA_PROXY_NAME', '',
|
21
|
-
referenced_resource: 'puppet_ca_proxy',
|
22
|
-
aliased_resource: 'puppet_ca_proxy'
|
23
|
-
base.option_family(
|
24
|
-
format: HammerCLI::Options::Normalizers::List.new,
|
25
|
-
aliased_resource: 'puppet-class',
|
26
|
-
description: 'Names/Ids of associated puppet classes'
|
27
|
-
) do
|
28
|
-
parent '--puppet-class-ids', 'PUPPET_CLASS_IDS', '',
|
29
|
-
attribute_name: :option_puppetclass_ids
|
30
|
-
child '--puppet-classes', 'PUPPET_CLASS_NAMES', '',
|
31
|
-
attribute_name: :option_puppetclass_names
|
32
|
-
end
|
33
17
|
bme_options = {}
|
34
18
|
bme_options[:default] = 'true' if base.action.to_sym == :create
|
35
19
|
|
@@ -56,7 +40,7 @@ module HammerCLIForeman
|
|
56
40
|
:capabilities, :flavour_ref, :image_ref, :start,
|
57
41
|
:network, :cpus, :memory, :provider, :type, :tenant_id, :image_id,
|
58
42
|
# ----------------------------------------------------------------------------------
|
59
|
-
:
|
43
|
+
:host_parameters_attributes, :interfaces_attributes, :root_pass]
|
60
44
|
end
|
61
45
|
|
62
46
|
def self.ask_password
|
@@ -69,12 +53,6 @@ module HammerCLIForeman
|
|
69
53
|
owner_id = owner_id(option_user_login, params['host']['owner_type'])
|
70
54
|
params['host']['owner_id'] ||= owner_id unless owner_id.nil?
|
71
55
|
|
72
|
-
puppet_proxy_id = proxy_id(option_puppet_proxy)
|
73
|
-
params['host']['puppet_proxy_id'] ||= puppet_proxy_id unless puppet_proxy_id.nil?
|
74
|
-
|
75
|
-
puppet_ca_proxy_id = proxy_id(option_puppet_ca_proxy)
|
76
|
-
params['host']['puppet_ca_proxy_id'] ||= puppet_ca_proxy_id unless puppet_ca_proxy_id.nil?
|
77
|
-
|
78
56
|
if action == :create
|
79
57
|
params['host']['build'] = true if option_build.nil?
|
80
58
|
params['host']['managed'] = true if option_managed.nil?
|
@@ -42,8 +42,6 @@ module HammerCLIForeman
|
|
42
42
|
:compute_resource => [ s_name(_("Compute resource name")) ],
|
43
43
|
:compute_profile => [ s_name(_("Compute profile name")) ],
|
44
44
|
:domain => [ s_name(_("Domain name")) ],
|
45
|
-
:environment => [s_name(_('Puppet environment name'))],
|
46
|
-
:puppet_environment => [s_name(_('Puppet environment name'))],
|
47
45
|
:fact_value => [],
|
48
46
|
:filter => [],
|
49
47
|
:host => [ s_name(_("Host name")) ],
|
@@ -66,7 +64,6 @@ module HammerCLIForeman
|
|
66
64
|
:override_value => [],
|
67
65
|
:ptable => [ s_name(_("Partition table name")) ],
|
68
66
|
:proxy => [ s_name(_("Proxy name")) ],
|
69
|
-
:puppetclass => [ s_name(_("Puppet class name")) ],
|
70
67
|
:config_report => [],
|
71
68
|
:role => [ s_name(_("User role name")) ],
|
72
69
|
:setting => [ s_name(_("Setting name"), :editable => false) ],
|
@@ -74,7 +71,6 @@ module HammerCLIForeman
|
|
74
71
|
:template => [],
|
75
72
|
:user => [ s("login", _("User's login to search by")) ],
|
76
73
|
:common_parameter => [ s_name(_("Common parameter name")) ],
|
77
|
-
:smart_class_parameter => [ s_name(_("Smart class parameter name"), :editable => false) ],
|
78
74
|
:template_combination => [],
|
79
75
|
:compute_attribute => []
|
80
76
|
}
|
@@ -129,44 +125,6 @@ module HammerCLIForeman
|
|
129
125
|
scoped_options
|
130
126
|
end
|
131
127
|
|
132
|
-
def puppetclass_ids(options)
|
133
|
-
resource_name = :puppetclasses
|
134
|
-
resource = @api.resource(resource_name)
|
135
|
-
results = if (ids = options[HammerCLI.option_accessor_name("ids")])
|
136
|
-
ids
|
137
|
-
elsif (ids = nil_from_searchables(resource_name, options, :plural => true))
|
138
|
-
ids
|
139
|
-
elsif options_not_set?(resource, options)
|
140
|
-
raise MissingSearchOptions.new(_("Missing options to search %s") % resource.name, resource)
|
141
|
-
elsif options_empty?(resource, options)
|
142
|
-
[]
|
143
|
-
else
|
144
|
-
require('hammer_cli_foreman/puppet_class')
|
145
|
-
results = HammerCLIForeman::PuppetClass::ListCommand.unhash_classes(
|
146
|
-
resolved_call(resource_name, :index, options, :multi)
|
147
|
-
)
|
148
|
-
raise ResolverError.new(_("one of %s not found.") % resource.name, resource) if results.count < expected_record_count(options, resource, :multi)
|
149
|
-
|
150
|
-
results.map { |r| r['id'] }
|
151
|
-
end
|
152
|
-
end
|
153
|
-
|
154
|
-
def environment_id(options)
|
155
|
-
puppet_environment_id(options)
|
156
|
-
end
|
157
|
-
|
158
|
-
def puppet_environment_id(options)
|
159
|
-
get_id(:environments, options)
|
160
|
-
end
|
161
|
-
|
162
|
-
def environment_ids(options)
|
163
|
-
puppet_environment_ids(options)
|
164
|
-
end
|
165
|
-
|
166
|
-
def puppet_environment_ids(options)
|
167
|
-
get_ids(:environments, options)
|
168
|
-
end
|
169
|
-
|
170
128
|
def searchables(resource)
|
171
129
|
resource = @api.resource(resource) if resource.is_a? Symbol
|
172
130
|
@searchables.for(resource)
|
@@ -331,17 +289,6 @@ module HammerCLIForeman
|
|
331
289
|
0
|
332
290
|
end
|
333
291
|
|
334
|
-
# puppet class search results are in non-standard format
|
335
|
-
# and needs to be un-hashed first
|
336
|
-
def puppetclass_id(options)
|
337
|
-
return options[HammerCLI.option_accessor_name("id")] if options[HammerCLI.option_accessor_name("id")]
|
338
|
-
resource = @api.resource(:puppetclasses)
|
339
|
-
results = find_resource_raw(:puppetclasses, options)
|
340
|
-
require('hammer_cli_foreman/puppet_class')
|
341
|
-
results = HammerCLIForeman::PuppetClass::ListCommand.unhash_classes(results)
|
342
|
-
pick_result(results, resource)['id']
|
343
|
-
end
|
344
|
-
|
345
292
|
def options_empty?(resource, options)
|
346
293
|
searchables(resource).all? do |s|
|
347
294
|
values = options[HammerCLI.option_accessor_name(s.plural_name.to_s)]
|
@@ -356,14 +303,6 @@ module HammerCLIForeman
|
|
356
303
|
end
|
357
304
|
end
|
358
305
|
|
359
|
-
def create_smart_class_parameters_search_options(options, mode = nil)
|
360
|
-
search_options = {}
|
361
|
-
value = options[HammerCLI.option_accessor_name('name')]
|
362
|
-
search_options[:search] = "key = \"#{value}\""
|
363
|
-
search_options[:puppetclass_id] = puppetclass_id(scoped_options("puppetclass", options))
|
364
|
-
search_options
|
365
|
-
end
|
366
|
-
|
367
306
|
# @param mode [Symbol] mode in which ids are searched :single, :multi, nil for old beahvior
|
368
307
|
def create_search_options(options, resource, mode = nil)
|
369
308
|
searchables(resource).each do |s|
|