hammer_cli_foreman 2.5.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 +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
@@ -36,7 +36,6 @@ module HammerCLIForeman
|
|
36
36
|
HammerCLIForeman::References.partition_tables(self)
|
37
37
|
HammerCLIForeman::References.domains(self)
|
38
38
|
HammerCLIForeman::References.realms(self)
|
39
|
-
HammerCLIForeman::References.environments(self)
|
40
39
|
HammerCLIForeman::References.hostgroups(self)
|
41
40
|
HammerCLIForeman::References.parameters(self)
|
42
41
|
collection :organizations, _("Organizations"), :numbered => false, :hide_blank => true do
|
@@ -58,8 +57,6 @@ module HammerCLIForeman
|
|
58
57
|
failure_message _("Could not create the location")
|
59
58
|
|
60
59
|
build_options
|
61
|
-
|
62
|
-
extend_with(HammerCLIForeman::CommandExtensions::PuppetEnvironments.new)
|
63
60
|
end
|
64
61
|
|
65
62
|
|
@@ -72,8 +69,6 @@ module HammerCLIForeman
|
|
72
69
|
failure_message _("Could not update the location")
|
73
70
|
|
74
71
|
build_options
|
75
|
-
|
76
|
-
extend_with(HammerCLIForeman::CommandExtensions::PuppetEnvironments.new)
|
77
72
|
end
|
78
73
|
|
79
74
|
|
@@ -112,7 +107,6 @@ module HammerCLIForeman
|
|
112
107
|
end
|
113
108
|
|
114
109
|
HammerCLIForeman::AssociatingCommands::Hostgroup.extend_command(self)
|
115
|
-
HammerCLIForeman::AssociatingCommands::PuppetEnvironment.extend_command(self)
|
116
110
|
HammerCLIForeman::AssociatingCommands::Domain.extend_command(self)
|
117
111
|
HammerCLIForeman::AssociatingCommands::Medium.extend_command(self)
|
118
112
|
HammerCLIForeman::AssociatingCommands::Subnet.extend_command(self)
|
@@ -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
|
class InfoCommand < HammerCLIForeman::InfoCommand
|
@@ -22,7 +22,7 @@ module HammerCLIForeman
|
|
22
22
|
field :subscription_type, _("Subscription type")
|
23
23
|
end
|
24
24
|
|
25
|
-
build_options
|
25
|
+
build_options
|
26
26
|
end
|
27
27
|
|
28
28
|
autoload_subcommands
|
@@ -13,7 +13,7 @@ module HammerCLIForeman
|
|
13
13
|
field :hardware_model, _("HW model")
|
14
14
|
end
|
15
15
|
|
16
|
-
build_options
|
16
|
+
build_options
|
17
17
|
end
|
18
18
|
|
19
19
|
|
@@ -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,14 +31,14 @@ module HammerCLIForeman
|
|
31
31
|
success_message _("Hardware model created.")
|
32
32
|
failure_message _("Could not create the hardware model")
|
33
33
|
|
34
|
-
build_options
|
34
|
+
build_options
|
35
35
|
end
|
36
36
|
|
37
37
|
class DeleteCommand < HammerCLIForeman::DeleteCommand
|
38
38
|
success_message _("Hardware model deleted.")
|
39
39
|
failure_message _("Could not delete the hardware model")
|
40
40
|
|
41
|
-
build_options
|
41
|
+
build_options
|
42
42
|
end
|
43
43
|
|
44
44
|
|
@@ -46,7 +46,7 @@ module HammerCLIForeman
|
|
46
46
|
success_message _("Hardware model updated.")
|
47
47
|
failure_message _("Could not update the hardware model")
|
48
48
|
|
49
|
-
build_options
|
49
|
+
build_options
|
50
50
|
end
|
51
51
|
|
52
52
|
|
@@ -13,7 +13,7 @@ module HammerCLIForeman
|
|
13
13
|
field :family, _("Family")
|
14
14
|
end
|
15
15
|
|
16
|
-
build_options
|
16
|
+
build_options
|
17
17
|
end
|
18
18
|
|
19
19
|
|
@@ -36,7 +36,7 @@ module HammerCLIForeman
|
|
36
36
|
HammerCLIForeman::References.parameters(self)
|
37
37
|
end
|
38
38
|
|
39
|
-
build_options
|
39
|
+
build_options
|
40
40
|
end
|
41
41
|
|
42
42
|
|
@@ -44,7 +44,7 @@ module HammerCLIForeman
|
|
44
44
|
success_message _("Operating system created.")
|
45
45
|
failure_message _("Could not create the operating system")
|
46
46
|
|
47
|
-
build_options
|
47
|
+
build_options
|
48
48
|
end
|
49
49
|
|
50
50
|
|
@@ -52,7 +52,7 @@ module HammerCLIForeman
|
|
52
52
|
success_message _("Operating system updated.")
|
53
53
|
failure_message _("Could not update the operating system")
|
54
54
|
|
55
|
-
build_options
|
55
|
+
build_options
|
56
56
|
end
|
57
57
|
|
58
58
|
|
@@ -60,7 +60,7 @@ module HammerCLIForeman
|
|
60
60
|
success_message _("Operating system deleted.")
|
61
61
|
failure_message _("Could not delete the operating system")
|
62
62
|
|
63
|
-
build_options
|
63
|
+
build_options
|
64
64
|
end
|
65
65
|
|
66
66
|
|
@@ -76,7 +76,7 @@ module HammerCLIForeman
|
|
76
76
|
validator.any(:option_operatingsystem_id, :option_operatingsystem_title).required
|
77
77
|
end
|
78
78
|
|
79
|
-
build_options
|
79
|
+
build_options
|
80
80
|
end
|
81
81
|
|
82
82
|
|
@@ -90,7 +90,7 @@ module HammerCLIForeman
|
|
90
90
|
validator.any(:option_operatingsystem_id, :option_operatingsystem_title).required
|
91
91
|
end
|
92
92
|
|
93
|
-
build_options
|
93
|
+
build_options
|
94
94
|
end
|
95
95
|
|
96
96
|
|
@@ -156,8 +156,8 @@ module HammerCLIForeman
|
|
156
156
|
HammerCLI::EX_OK
|
157
157
|
end
|
158
158
|
|
159
|
-
build_options
|
160
|
-
|
159
|
+
build_options without: [:template_kind_id, :type]
|
160
|
+
|
161
161
|
end
|
162
162
|
|
163
163
|
|
@@ -192,7 +192,7 @@ module HammerCLIForeman
|
|
192
192
|
{"operatingsystem_id" => option_id}
|
193
193
|
end
|
194
194
|
|
195
|
-
build_options
|
195
|
+
build_options
|
196
196
|
end
|
197
197
|
|
198
198
|
|
@@ -13,22 +13,39 @@ module HammerCLIForeman
|
|
13
13
|
IdParamsFilter.new(:only_required => false).for_action(@command.resource.action(@command.action))
|
14
14
|
end
|
15
15
|
|
16
|
-
def
|
16
|
+
def needs_resolving?(param_option, param_resource, all_opts)
|
17
|
+
return false unless param_updatable?(param_resource)
|
18
|
+
|
19
|
+
searchables_set = @command.searchables.for(param_resource).any? do |s|
|
20
|
+
option = HammerCLI.option_accessor_name("#{param_resource.singular_name}_#{s.name}")
|
21
|
+
!all_opts[option].nil?
|
22
|
+
end
|
23
|
+
return all_opts[param_option].nil? unless searchables_set
|
24
|
+
|
25
|
+
# Remove set '<resource_name>_id' option to force resolving in case of
|
26
|
+
# '<resource_name>_[name|title]' was set
|
27
|
+
all_opts.delete(param_option)
|
28
|
+
true
|
29
|
+
end
|
30
|
+
|
31
|
+
def get_options(_defined_options, result)
|
17
32
|
# resolve all '<resource_name>_id' parameters if they are defined as options
|
18
33
|
# (they can be skipped using .without or .expand.except)
|
19
34
|
return result if @command.action.nil?
|
35
|
+
|
20
36
|
available_id_params.each do |api_param|
|
21
37
|
param_resource = HammerCLIForeman.param_to_resource(api_param.name)
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
38
|
+
param_option = HammerCLI.option_accessor_name(api_param.name)
|
39
|
+
next unless needs_resolving?(param_option, param_resource, result)
|
40
|
+
|
41
|
+
resource_id = @command.get_resource_id(
|
42
|
+
param_resource, scoped: true, required: api_param.required?, all_options: result
|
43
|
+
)
|
44
|
+
result[param_option] = resource_id if resource_id
|
26
45
|
end
|
27
46
|
result
|
28
|
-
|
29
47
|
rescue HammerCLIForeman::MissingSearchOptions => e
|
30
|
-
|
31
|
-
switches = @command.class.find_options(:referenced_resource => e.resource.singular_name).map(&:long_switch)
|
48
|
+
switches = @command.class.find_options(referenced_resource: e.resource.singular_name).map(&:long_switch)
|
32
49
|
|
33
50
|
if switches.empty?
|
34
51
|
error_message = _("Could not find %{resource}. Some search options were missing, please see --help.")
|
@@ -40,8 +57,8 @@ module HammerCLIForeman
|
|
40
57
|
|
41
58
|
raise MissingSearchOptions.new(
|
42
59
|
error_message % {
|
43
|
-
:
|
44
|
-
:
|
60
|
+
resource: e.resource.singular_name,
|
61
|
+
switches: switches.join(', ')
|
45
62
|
},
|
46
63
|
e.resource
|
47
64
|
)
|
@@ -13,15 +13,34 @@ module HammerCLIForeman
|
|
13
13
|
IdArrayParamsFilter.new(:only_required => false).for_action(@command.resource.action(@command.action))
|
14
14
|
end
|
15
15
|
|
16
|
-
def
|
17
|
-
return
|
16
|
+
def needs_resolving?(param_option, param_resource, all_opts)
|
17
|
+
return false unless param_updatable?(param_resource)
|
18
|
+
|
19
|
+
searchables_set = @command.searchables.for(param_resource).any? do |s|
|
20
|
+
option = HammerCLI.option_accessor_name("#{param_resource.singular_name}_#{s.plural_name}")
|
21
|
+
!all_opts[option].nil?
|
22
|
+
end
|
23
|
+
return all_opts[param_option].nil? unless searchables_set
|
24
|
+
|
25
|
+
# Remove set '<resource_name>_ids' option to force resolving in case of
|
26
|
+
# '<resource_name>_[names|titles]' was set
|
27
|
+
all_opts.delete(param_option)
|
28
|
+
true
|
29
|
+
end
|
30
|
+
|
31
|
+
def get_options(_defined_options, result)
|
18
32
|
# resolve all '<resource_name>_ids' parameters if they are defined as options
|
33
|
+
return result if @command.action.nil?
|
34
|
+
|
19
35
|
available_ids_params.each do |api_param|
|
20
36
|
param_resource = HammerCLIForeman.param_to_resource(api_param.name)
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
37
|
+
param_option = HammerCLI.option_accessor_name(api_param.name)
|
38
|
+
next unless needs_resolving?(param_option, param_resource, result)
|
39
|
+
|
40
|
+
resource_ids = @command.get_resource_ids(
|
41
|
+
param_resource, scoped: true, required: api_param.required?, all_options: result
|
42
|
+
)
|
43
|
+
result[param_option] = resource_ids if resource_ids
|
25
44
|
end
|
26
45
|
result
|
27
46
|
end
|
@@ -3,6 +3,5 @@ require 'hammer_cli_foreman/option_sources/ids_params'
|
|
3
3
|
require 'hammer_cli_foreman/option_sources/self_param'
|
4
4
|
require 'hammer_cli_foreman/option_sources/user_params'
|
5
5
|
require 'hammer_cli_foreman/option_sources/fields_params'
|
6
|
-
require 'hammer_cli_foreman/option_sources/puppet_environment_params'
|
7
6
|
require 'hammer_cli_foreman/option_sources/new_params'
|
8
7
|
require 'hammer_cli_foreman/option_sources/referenced_resource_id_params'
|
@@ -36,7 +36,6 @@ module HammerCLIForeman
|
|
36
36
|
HammerCLIForeman::References.partition_tables(self)
|
37
37
|
HammerCLIForeman::References.domains(self)
|
38
38
|
HammerCLIForeman::References.realms(self)
|
39
|
-
HammerCLIForeman::References.environments(self)
|
40
39
|
HammerCLIForeman::References.hostgroups(self)
|
41
40
|
HammerCLIForeman::References.parameters(self)
|
42
41
|
collection :locations, _("Locations"), :numbered => false, :hide_blank => true do
|
@@ -59,8 +58,6 @@ module HammerCLIForeman
|
|
59
58
|
failure_message _("Could not create the organization")
|
60
59
|
|
61
60
|
build_options
|
62
|
-
|
63
|
-
extend_with(HammerCLIForeman::CommandExtensions::PuppetEnvironments.new)
|
64
61
|
end
|
65
62
|
|
66
63
|
|
@@ -73,8 +70,6 @@ module HammerCLIForeman
|
|
73
70
|
failure_message _("Could not update the organization")
|
74
71
|
|
75
72
|
build_options
|
76
|
-
|
77
|
-
extend_with(HammerCLIForeman::CommandExtensions::PuppetEnvironments.new)
|
78
73
|
end
|
79
74
|
|
80
75
|
|
@@ -114,7 +109,6 @@ module HammerCLIForeman
|
|
114
109
|
|
115
110
|
|
116
111
|
HammerCLIForeman::AssociatingCommands::Hostgroup.extend_command(self)
|
117
|
-
HammerCLIForeman::AssociatingCommands::PuppetEnvironment.extend_command(self)
|
118
112
|
HammerCLIForeman::AssociatingCommands::Domain.extend_command(self)
|
119
113
|
HammerCLIForeman::AssociatingCommands::Medium.extend_command(self)
|
120
114
|
HammerCLIForeman::AssociatingCommands::Subnet.extend_command(self)
|
@@ -112,14 +112,6 @@ module HammerCLIForeman
|
|
112
112
|
end
|
113
113
|
end
|
114
114
|
|
115
|
-
def self.environments(dsl)
|
116
|
-
dsl.build do
|
117
|
-
collection :environments, _("Environments"), :numbered => false do
|
118
|
-
custom_field Fields::Reference
|
119
|
-
end
|
120
|
-
end
|
121
|
-
end
|
122
|
-
|
123
115
|
def self.hostgroups(dsl)
|
124
116
|
dsl.build do
|
125
117
|
collection :hostgroups, _("Hostgroups"), :numbered => false do
|
@@ -153,14 +145,6 @@ module HammerCLIForeman
|
|
153
145
|
end
|
154
146
|
end
|
155
147
|
|
156
|
-
def self.puppetclasses(dsl)
|
157
|
-
dsl.build do
|
158
|
-
collection :puppetclasses, _("Puppetclasses"), :numbered => false do
|
159
|
-
custom_field Fields::Reference
|
160
|
-
end
|
161
|
-
end
|
162
|
-
end
|
163
|
-
|
164
148
|
def self.operating_systems(dsl)
|
165
149
|
dsl.build do
|
166
150
|
collection :operatingsystems, _("Operating systems"), :numbered => false do
|
@@ -20,7 +20,7 @@ module HammerCLIForeman
|
|
20
20
|
data
|
21
21
|
end
|
22
22
|
|
23
|
-
build_options
|
23
|
+
build_options
|
24
24
|
end
|
25
25
|
|
26
26
|
class UpdateCommand < HammerCLIForeman::UpdateCommand
|
@@ -29,7 +29,7 @@ module HammerCLIForeman
|
|
29
29
|
success_message _("Setting [%{name}] updated to [%{value}].")
|
30
30
|
failure_message _("Could not update the setting")
|
31
31
|
|
32
|
-
build_options
|
32
|
+
build_options
|
33
33
|
end
|
34
34
|
|
35
35
|
class InfoCommand < HammerCLIForeman::InfoCommand
|
@@ -42,7 +42,7 @@ module HammerCLIForeman
|
|
42
42
|
field :value, _("Value")
|
43
43
|
end
|
44
44
|
|
45
|
-
build_options
|
45
|
+
build_options
|
46
46
|
end
|
47
47
|
|
48
48
|
|
@@ -60,58 +60,6 @@ module HammerCLIForeman
|
|
60
60
|
build_options
|
61
61
|
end
|
62
62
|
|
63
|
-
|
64
|
-
class ImportPuppetClassesCommand < HammerCLIForeman::Command
|
65
|
-
action :import_puppetclasses
|
66
|
-
|
67
|
-
command_name "import-classes"
|
68
|
-
|
69
|
-
option "--dryrun", :flag, _("Do not run the import")
|
70
|
-
|
71
|
-
output do
|
72
|
-
field :message, _("Result"), Fields::LongText
|
73
|
-
collection :results, _("Changed environments"), :hide_blank => true do
|
74
|
-
field :name, nil
|
75
|
-
collection :new_puppetclasses, _("New classes"), :hide_blank => true, :numbered => false do
|
76
|
-
field nil, nil
|
77
|
-
end
|
78
|
-
collection :updated_puppetclasses, _("Updated classes"), :hide_blank => true, :numbered => false do
|
79
|
-
field nil, nil
|
80
|
-
end
|
81
|
-
collection :obsolete_puppetclasses, _("Removed classes"), :hide_blank => true, :numbered => false do
|
82
|
-
field nil, nil
|
83
|
-
end
|
84
|
-
collection :ignored_puppetclasses, _("Ignored classes"), :hide_blank => true, :numbered => false do
|
85
|
-
field nil, nil
|
86
|
-
end
|
87
|
-
end
|
88
|
-
end
|
89
|
-
|
90
|
-
build_options do |o|
|
91
|
-
o.without(:smart_proxy_id, :dryrun)
|
92
|
-
o.expand.except(:smart_proxies)
|
93
|
-
end
|
94
|
-
|
95
|
-
def request_params
|
96
|
-
opts = super
|
97
|
-
opts['dryrun'] = option_dryrun? || false
|
98
|
-
opts
|
99
|
-
end
|
100
|
-
|
101
|
-
def transform_format(data)
|
102
|
-
# Overriding the default behavior that tries to remove nesting
|
103
|
-
# when there's only {"message": "..."}
|
104
|
-
data
|
105
|
-
end
|
106
|
-
|
107
|
-
def print_data(record)
|
108
|
-
print_record(output_definition, record)
|
109
|
-
end
|
110
|
-
|
111
|
-
extend_with(HammerCLIForeman::CommandExtensions::PuppetEnvironment.new)
|
112
|
-
end
|
113
|
-
|
114
|
-
|
115
63
|
class RefreshFeaturesCommand < HammerCLIForeman::Command
|
116
64
|
|
117
65
|
action :refresh
|
@@ -13,7 +13,7 @@ module HammerCLIForeman
|
|
13
13
|
field :admin, _("Admin"), Fields::Boolean
|
14
14
|
end
|
15
15
|
|
16
|
-
build_options
|
16
|
+
build_options
|
17
17
|
end
|
18
18
|
|
19
19
|
class InfoCommand < HammerCLIForeman::InfoCommand
|
@@ -25,28 +25,28 @@ module HammerCLIForeman
|
|
25
25
|
HammerCLIForeman::References.timestamps(self)
|
26
26
|
end
|
27
27
|
|
28
|
-
build_options
|
28
|
+
build_options
|
29
29
|
end
|
30
30
|
|
31
31
|
class CreateCommand < HammerCLIForeman::CreateCommand
|
32
32
|
success_message _("User group [%<name>s] created.")
|
33
33
|
failure_message _("Could not create the user group")
|
34
34
|
|
35
|
-
build_options
|
35
|
+
build_options
|
36
36
|
end
|
37
37
|
|
38
38
|
class UpdateCommand < HammerCLIForeman::UpdateCommand
|
39
39
|
success_message _("User group [%<name>s] updated.")
|
40
40
|
failure_message _("Could not update the user group")
|
41
41
|
|
42
|
-
build_options
|
42
|
+
build_options
|
43
43
|
end
|
44
44
|
|
45
45
|
class DeleteCommand < HammerCLIForeman::DeleteCommand
|
46
46
|
success_message _("User group [%<name>s] deleted.")
|
47
47
|
failure_message _("Could not delete the user group")
|
48
48
|
|
49
|
-
build_options
|
49
|
+
build_options
|
50
50
|
end
|
51
51
|
|
52
52
|
HammerCLIForeman::AssociatingCommands::Role.extend_command(self)
|
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 classes"),
|
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
|
)
|
@@ -3,7 +3,7 @@ require "json"
|
|
3
3
|
module Minitest
|
4
4
|
class CoverageRunner
|
5
5
|
|
6
|
-
RESOURCE_BLACK_LIST = ['tasks','home','
|
6
|
+
RESOURCE_BLACK_LIST = ['tasks','home','statistics','table_preferences','autosign']
|
7
7
|
attr_reader :raw_data, :api_endpoints, :covered_resources, :uncovered_resources, :partially_covered_resources
|
8
8
|
def initialize(file_path)
|
9
9
|
@raw_data = JSON.load(File.open(file_path))
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
@@ -7,9 +7,9 @@ describe 'architecture' do
|
|
7
7
|
before do
|
8
8
|
@cmd = %w[architecture list]
|
9
9
|
@architectures = [{
|
10
|
-
|
11
|
-
|
12
|
-
|
10
|
+
id: 1,
|
11
|
+
name: 'i386'
|
12
|
+
}]
|
13
13
|
end
|
14
14
|
|
15
15
|
it 'should return a list of architectures' do
|
@@ -26,7 +26,7 @@ describe 'architecture' do
|
|
26
26
|
end
|
27
27
|
|
28
28
|
it 'should run list command with defaults' do
|
29
|
-
providers = { 'foreman' => HammerCLIForeman::Defaults.new(api_connection({}, '2.
|
29
|
+
providers = { 'foreman' => HammerCLIForeman::Defaults.new(api_connection({}, '2.5')) }
|
30
30
|
defaults = HammerCLI::Defaults.new(
|
31
31
|
{
|
32
32
|
organization_id: {
|
@@ -39,6 +39,8 @@ describe 'architecture' do
|
|
39
39
|
)
|
40
40
|
defaults.stubs(:write_to_file).returns(true)
|
41
41
|
defaults.stubs(:providers).returns(providers)
|
42
|
+
api_expects(:users, :index, 'Find user').with_params(search: 'login=admin').returns(index_response([{ 'default_organization' => { 'id' => 2 } }]))
|
43
|
+
api_expects(:users, :index, 'Find user').with_params(search: 'login=admin').returns(index_response([{ 'default_location' => { 'id' => 1 } }]))
|
42
44
|
api_expects(:architectures, :index, 'List architectures').returns(@architectures)
|
43
45
|
|
44
46
|
result = run_cmd(@cmd, { use_defaults: true, defaults: defaults })
|
@@ -29,7 +29,7 @@ describe 'bookmark' do
|
|
29
29
|
end
|
30
30
|
|
31
31
|
it 'should run list command with defaults' do
|
32
|
-
providers = { 'foreman' => HammerCLIForeman::Defaults.new(api_connection({}, '2.
|
32
|
+
providers = { 'foreman' => HammerCLIForeman::Defaults.new(api_connection({}, '2.5')) }
|
33
33
|
defaults = HammerCLI::Defaults.new(
|
34
34
|
{
|
35
35
|
organization_id: {
|
@@ -42,6 +42,8 @@ describe 'bookmark' do
|
|
42
42
|
)
|
43
43
|
defaults.stubs(:write_to_file).returns(true)
|
44
44
|
defaults.stubs(:providers).returns(providers)
|
45
|
+
api_expects(:users, :index, 'Find user').with_params(search: 'login=admin').returns(index_response([{ 'default_organization' => { 'id' => 2 } }]))
|
46
|
+
api_expects(:users, :index, 'Find user').with_params(search: 'login=admin').returns(index_response([{ 'default_location' => { 'id' => 1 } }]))
|
45
47
|
api_expects(:bookmarks, :index, 'List bookmarks').returns(@bookmarks)
|
46
48
|
|
47
49
|
result = run_cmd(@cmd, { use_defaults: true, defaults: defaults })
|
@@ -132,7 +132,7 @@ describe "parameters" do
|
|
132
132
|
end
|
133
133
|
|
134
134
|
it 'should run list command with defaults' do
|
135
|
-
providers = { 'foreman' => HammerCLIForeman::Defaults.new(api_connection({}, '2.
|
135
|
+
providers = { 'foreman' => HammerCLIForeman::Defaults.new(api_connection({}, '2.5')) }
|
136
136
|
defaults = HammerCLI::Defaults.new(
|
137
137
|
{
|
138
138
|
organization_id: {
|
@@ -145,6 +145,8 @@ describe "parameters" do
|
|
145
145
|
)
|
146
146
|
defaults.stubs(:write_to_file).returns(true)
|
147
147
|
defaults.stubs(:providers).returns(providers)
|
148
|
+
api_expects(:users, :index, 'Find user').with_params(search: 'login=admin').returns(index_response([{ 'default_organization' => { 'id' => 2 } }]))
|
149
|
+
api_expects(:users, :index, 'Find user').with_params(search: 'login=admin').returns(index_response([{ 'default_location' => { 'id' => 1 } }]))
|
148
150
|
api_expects(:compute_profiles, :index, 'List compute profiles').returns(@compute_profiles)
|
149
151
|
|
150
152
|
result = run_cmd(@cmd, { use_defaults: true, defaults: defaults })
|