importcsv module¶
-
class
importcsv.ImportDevices(db_path_name)¶ Bases:
dbparam.DbParamClass to import data from a CSV file
Format: customer,site,dev_name,dev_ip,os,userid,passwd,salt_proxy_required
Names should be alphanumeric, and less than 20 characters, all names will be transformed to lowercase.
-
add_line_to_db(checked_line_values, line_number)¶ Add a customers, sites and devices to the DB.
Parameters: - checked_line_values – CSV line to import to DB.
- line_number – line number being processed.
Returns: Trueif the lines was added andFalseif not.
-
-
importcsv._check_values(line_value_list)¶ Verify the values of each field of the line being processed.
Parameters: line_value_list – contains the line transformed to a list Returns: line_value_listwith corrections, orFalseif the list has an invalid value.
-
importcsv._import_csv(destination_db_to_import, csv_file_to_import)¶ Import the CSV to the DB
Parameters: - destination_db_to_import – DB to import the CSV
- csv_file_to_import – the file to import to the DB
Returns: total_lines_number_processedandlines_imported
-
importcsv.start_process()¶ Starts the process of import the CSV to DB, asking for the path names to the files.
Returns: Nothing