Class: HammerCLIForeman::RemoveAssociatedCommand

Inherits:
AssociatedCommand show all
Defined in:
lib/hammer_cli_foreman/commands.rb

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from AssociatedCommand

associated_identifiers, associated_resource, #associated_resource, declared_associated_identifiers, #get_current_ids, #get_required_id, #initialize, #request_params, #setup_associated_identifier_options, #validate_options

Methods inherited from WriteCommand

#send_request, #success_message_params

Constructor Details

This class inherits a constructor from HammerCLIForeman::AssociatedCommand

Class Method Details

.command_name(name = nil) ⇒ Object



266
267
268
# File 'lib/hammer_cli_foreman/commands.rb', line 266

def self.command_name(name=nil)
  super(name) || (associated_resource ? "remove_"+associated_resource.name : nil)
end

.desc(desc = nil) ⇒ Object



270
271
272
# File 'lib/hammer_cli_foreman/commands.rb', line 270

def self.desc(desc=nil)
  "Disassociate a resource"
end

Instance Method Details

#get_new_idsObject



274
275
276
277
278
279
280
# File 'lib/hammer_cli_foreman/commands.rb', line 274

def get_new_ids
  ids = get_current_ids
  required_id = get_required_id

  ids = ids.delete_if { |id| id == required_id }
  ids
end