Class: HammerCLIForeman::OperatingSystem::DeleteOsDefaultTemplate
- Inherits:
-
Command
- Object
- HammerCLI::Apipie::Command
- Command
- HammerCLIForeman::OperatingSystem::DeleteOsDefaultTemplate
show all
- Defined in:
- lib/hammer_cli_foreman/operating_system.rb
Instance Method Summary
collapse
Methods inherited from Command
alias_name_for_resource, build_options, connection_name, create_option_builder, #customized_options, #dependency_resolver, dependency_resolver, #exception_handler_class, #get_identifier, #get_resource_id, #get_resource_ids, #request_params, resolver, #resolver, resource_alias_name_mapping, resource_config, resource_name_mapping, #searchables, searchables, #send_request, #transform_format
Instance Method Details
#base_action_params ⇒ Object
191
192
193
|
# File 'lib/hammer_cli_foreman/operating_system.rb', line 191
def base_action_params
{"operatingsystem_id" => option_id}
end
|
#execute ⇒ Object
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
|
# File 'lib/hammer_cli_foreman/operating_system.rb', line 174
def execute
templates = HammerCLIForeman.collection_to_common_format(resource.call(:index, base_action_params))
tpl = templates.find { |p| p["template_kind_name"] == option_type }
if tpl.nil?
raise RuntimeError.new(_("Default template of type %s not found") % option_type)
end
params = {
"id" => tpl["id"]
}.merge base_action_params
HammerCLIForeman.record_to_common_format(resource.call(:destroy, params))
print_message success_message if success_message
HammerCLI::EX_OK
end
|