Class: HammerCLIForeman::RemoveAssociatedCommand
Direct Known Subclasses
AssociatingCommands::Architecture::RemoveArchitectureCommand, AssociatingCommands::ComputeResource::RemoveComputeResourceCommand, AssociatingCommands::ConfigTemplate::RemoveConfigTemplateCommand, AssociatingCommands::Domain::RemoveDomainCommand, AssociatingCommands::Environment::RemoveEnvironmentCommand, AssociatingCommands::Hostgroup::RemoveHostgroupCommand, AssociatingCommands::Location::RemoveLocationCommand, AssociatingCommands::Medium::RemoveMediumCommand, AssociatingCommands::OperatingSystem::RemoveOSCommand, AssociatingCommands::Organization::RemoveOrganizationCommand, AssociatingCommands::PartitionTable::RemovePartitionTableCommand, AssociatingCommands::Role::RemoveRoleCommand, AssociatingCommands::SmartProxy::RemoveSmartProxyCommand, AssociatingCommands::Subnet::RemoveSubnetCommand, AssociatingCommands::User::RemoveUserCommand, AssociatingCommands::Usergroup::RemoveUsergroupCommand
Class Method Summary
collapse
Instance Method Summary
collapse
associated_resource, #associated_resource, #association_name, create_option_builder, default_message, #get_associated_identifier, #get_current_ids, #request_params
Methods inherited from Command
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_config, resource_name_mapping, #searchables, searchables, #send_request, #transform_format
Class Method Details
.command_name(name = nil) ⇒ Object
528
529
530
531
|
# File 'lib/hammer_cli_foreman/commands.rb', line 528
def self.command_name(name=nil)
name = super(name) || (associated_resource ? "remove-"+associated_resource.singular_name : nil)
name.respond_to?(:gsub) ? name.gsub('_', '-') : name
end
|
.desc(desc = nil) ⇒ Object
533
534
535
536
|
# File 'lib/hammer_cli_foreman/commands.rb', line 533
def self.desc(desc=nil)
description = super(desc) || ''
description.strip.empty? ? _("Disassociate a resource") : description
end
|
.failure_message(msg = nil) ⇒ Object
546
547
548
|
# File 'lib/hammer_cli_foreman/commands.rb', line 546
def self.failure_message(msg = nil)
super(msg) || default_message(_('Could not disassociate the %{resource_name}'))
end
|
.success_message(msg = nil) ⇒ Object
550
551
552
|
# File 'lib/hammer_cli_foreman/commands.rb', line 550
def self.success_message(msg = nil)
super(msg) || default_message(_('The %{resource_name} has been disassociated'))
end
|
Instance Method Details
#get_new_ids ⇒ Object
538
539
540
541
542
543
544
|
# File 'lib/hammer_cli_foreman/commands.rb', line 538
def get_new_ids
ids = get_current_ids.map(&:to_s)
required_id = get_associated_identifier.to_s
ids = ids.delete_if { |id| id == required_id }
ids
end
|