Class: HammerCLIImport::ImportCommand::SystemGroupImportCommand

Inherits:
BaseCommand
  • Object
show all
Defined in:
lib/hammer_cli_import/hostcollection.rb

Instance Attribute Summary

Attributes included from PersistentMap::Extend

#map_description, #map_target_entity, #maps

Instance Method Summary collapse

Methods inherited from BaseCommand

#_compare_hash, #_create_entity, #api_call, api_call, api_init, #create_entity, csv_columns, #cvs_iterate, #data_dir, #delete, #delete_entity, #delete_entity_by_import_id, #execute, #find_uniq, #found_errors, #get_cache, #get_original_id, #get_translated_id, #import, #initialize, #last_in_cache?, #list_server_entities, #load_cache, #lookup_entity, #lookup_entity_in_array, #lookup_entity_in_cache, #map_entity, #mapped_api_call, #post_delete, #post_import, #print_summary, #process_error, #recognizable_error, #report_summary, #split_multival, #to_singular, #unmap_entity, #update_entity, #wait_for_task, #was_translated

Methods included from PersistentMap::Extend

#persistent_map, #persistent_maps

Methods included from ImportTools::ImportLogging::Extend

#add_logging_options

Methods included from AsyncTasksReactor::Extend

#add_async_tasks_reactor_options

Methods included from AsyncTasksReactor::Include

#atr_exit, #atr_init, #postpone_till, #wait_for

Methods included from ImportTools::Exceptional::Include

#handle_missing_and_supress, #silently

Methods included from ImportTools::Task::Include

#annotate_tasks

Methods included from ImportTools::ImportLogging::Include

#debug, #error, #fatal, #info, #log, #logtrace, #progress, #setup_logging, #warn

Methods included from PersistentMap::Include

#load_persistent_maps, #map_target_entity, #maps, #prune_persistent_maps, #save_persistent_maps

Constructor Details

This class inherits a constructor from HammerCLIImport::BaseCommand

Instance Method Details

#delete_single_row(data) ⇒ Object



46
47
48
# File 'lib/hammer_cli_import/hostcollection.rb', line 46

def delete_single_row(data)
  delete_entity(:host_collections, data['group_id'].to_i)
end

#import_single_row(data) ⇒ Object



41
42
43
44
# File 'lib/hammer_cli_import/hostcollection.rb', line 41

def import_single_row(data)
  sg = mk_sg_hash data
  create_entity(:host_collections, sg, data['group_id'].to_i)
end

#mk_sg_hash(data) ⇒ Object



34
35
36
37
38
39
# File 'lib/hammer_cli_import/hostcollection.rb', line 34

def mk_sg_hash(data)
  {
    :name => data['name'],
    :organization_id => get_translated_id(:organizations, data['org_id'].to_i)
  }
end