Class: HammerCLIForeman::AddAssociatedCommand
- Inherits:
-
AssociatedCommand
- Object
- HammerCLI::Apipie::Command
- Command
- AssociatedCommand
- HammerCLIForeman::AddAssociatedCommand
- Defined in:
- lib/hammer_cli_foreman/commands.rb
Direct Known Subclasses
HammerCLIForeman::AssociatingCommands::Architecture::AddArchitectureCommand, HammerCLIForeman::AssociatingCommands::ComputeResource::AddComputeResourceCommand, HammerCLIForeman::AssociatingCommands::ConfigTemplate::AddConfigTemplateCommand, HammerCLIForeman::AssociatingCommands::Domain::AddDomainCommand, HammerCLIForeman::AssociatingCommands::Environment::AddEnvironmentCommand, HammerCLIForeman::AssociatingCommands::Hostgroup::AddHostgroupCommand, HammerCLIForeman::AssociatingCommands::Medium::AddMediumCommand, HammerCLIForeman::AssociatingCommands::OperatingSystem::AddOSCommand, HammerCLIForeman::AssociatingCommands::Organization::AddOrganizationCommand, HammerCLIForeman::AssociatingCommands::PartitionTable::AddPartitionTableCommand, HammerCLIForeman::AssociatingCommands::Role::AddRoleCommand, HammerCLIForeman::AssociatingCommands::SmartProxy::AddSmartProxyCommand, HammerCLIForeman::AssociatingCommands::Subnet::AddSubnetCommand, HammerCLIForeman::AssociatingCommands::User::AddUserCommand, HammerCLIForeman::AssociatingCommands::Usergroup::AddUsergroupCommand
Class Method Summary collapse
Instance Method Summary collapse
Methods inherited from AssociatedCommand
associated_resource, #associated_resource, #association_name, create_option_builder, #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, #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
510 511 512 513 |
# File 'lib/hammer_cli_foreman/commands.rb', line 510 def self.command_name(name=nil) name = super(name) || (associated_resource ? "add-"+associated_resource.singular_name : nil) name.respond_to?(:gsub) ? name.gsub('_', '-') : name end |
.desc(desc = nil) ⇒ Object
515 516 517 518 |
# File 'lib/hammer_cli_foreman/commands.rb', line 515 def self.desc(desc=nil) description = super(desc) || '' description.strip.empty? ? _("Associate a resource") : description end |
Instance Method Details
#get_new_ids ⇒ Object
520 521 522 523 524 525 526 |
# File 'lib/hammer_cli_foreman/commands.rb', line 520 def get_new_ids ids = get_current_ids.map(&:to_s) required_id = get_associated_identifier.to_s ids << required_id unless ids.include? required_id ids end |