Class: HammerCLIImport::ImportCommand::TemplateSnippetImportCommand
- Inherits:
-
BaseCommand
- Object
- HammerCLI::Apipie::Command
- BaseCommand
- HammerCLIImport::ImportCommand::TemplateSnippetImportCommand
- Defined in:
- lib/hammer_cli_import/templatesnippet.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
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
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
61 62 63 |
# File 'lib/hammer_cli_import/templatesnippet.rb', line 61 def delete_single_row(data) delete_entity(:template_snippets, data['id'].to_i) end |
#import_single_row(data) ⇒ Object
56 57 58 59 |
# File 'lib/hammer_cli_import/templatesnippet.rb', line 56 def import_single_row(data) snippet = mk_snippet_hash data create_entity(:template_snippets, snippet, data['id'].to_i) end |
#mk_snippet_hash(data) ⇒ Object
36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 |
# File 'lib/hammer_cli_import/templatesnippet.rb', line 36 def mk_snippet_hash(data) template = "%#{data['script_type']}" template += ' --nochroot' if data['chroot'] == 'N' template += " --interpreter #{data['interpreter']}" if data['interpreter'] template += "\n" template += data['data'] if data['data'] template += "\n" unless template.end_with? "\n" template += "%end\n" { :name => "#{data['kickstart_label']}-#{data['org_id']}-" \ "#{data['position']}-#{data['script_name']}-#{data['script_type']}", :template => template, # nowadays templates do not get associated with an organization # :organization_id => get_translated_id(:organizations, data['org_id'].to_i), :snippet => true, # audit_comment does not get stored anyway :audit_comment => '' } end |