Class: HammerCLIForeman::ListCommand
- Inherits:
-
Command
- Object
- HammerCLI::Apipie::Command
- Command
- HammerCLIForeman::ListCommand
show all
- Defined in:
- lib/hammer_cli_foreman/commands.rb
Direct Known Subclasses
Architecture::ListCommand, AssociatedResourceListCommand, AuthSourceLdap::ListCommand, CommonParameter::ListCommand, ComputeResource::ListCommand, Domain::ListCommand, Environment::ListCommand, ExternalUsergroup::ListCommand, ExternalUsergroup::RefreshExternalUsergroupsCommand, Fact::ListCommand, Filter::AvailablePermissionsCommand, Filter::AvailableResourcesCommand, Filter::ListCommand, Host::ListCommand, Host::PuppetClassesCommand, Hostgroup::ListCommand, Hostgroup::PuppetClassesCommand, Image::AvailableImagesCommand, Image::ListCommand, Interface::ListCommand, HammerCLIForeman::Location::ListCommand, Medium::ListCommand, Model::ListCommand, OperatingSystem::ListCommand, Organization::ListCommand, PartitionTable::ListCommand, PuppetClass::ListCommand, Report::ListCommand, Role::FiltersCommand, Role::ListCommand, Settings::ListCommand, SmartClassParameter::ListCommand, SmartClassParametersBriefList, SmartProxy::ListCommand, SmartVariable::ListCommand, SmartVariablesBriefList, Subnet::ListCommand, Template::ListCommand, Template::ListKindsCommand, User::ListCommand, Usergroup::ListCommand
Constant Summary
collapse
- RETRIEVE_ALL_PER_PAGE =
1000
- DEFAULT_PER_PAGE =
20
Class Method Summary
collapse
Instance Method Summary
collapse
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
Class Method Details
.command_name(name = nil) ⇒ Object
292
293
294
|
# File 'lib/hammer_cli_foreman/commands.rb', line 292
def self.command_name(name=nil)
super(name) || "list"
end
|
Instance Method Details
#adapter ⇒ Object
274
275
276
|
# File 'lib/hammer_cli_foreman/commands.rb', line 274
def adapter
@context[:adapter] || :table
end
|
#execute ⇒ Object
296
297
298
299
300
301
302
303
304
305
306
|
# File 'lib/hammer_cli_foreman/commands.rb', line 296
def execute
if should_retrieve_all?
print_data(retrieve_all)
else
self.option_page = (self.option_page || 1).to_i if respond_to?(:option_page)
self.option_per_page = (self.option_per_page || HammerCLI::Settings.get(:ui, :per_page) || DEFAULT_PER_PAGE).to_i if respond_to?(:option_per_page)
print_data(send_request)
end
return HammerCLI::EX_OK
end
|
#extend_data(record) ⇒ Object
288
289
290
|
# File 'lib/hammer_cli_foreman/commands.rb', line 288
def extend_data(record)
record
end
|
#send_request ⇒ Object
278
279
280
281
282
|
# File 'lib/hammer_cli_foreman/commands.rb', line 278
def send_request
set = super
set.map! { |r| extend_data(r) }
set
end
|