def engine_list(p_engine, p_username, p_format): """ List Masking engines from configuration file param1: p_engine: name of Masking engine param2: p_username: username param3: p_format: output format return None if OK or integer with error, ex. no rows found """ data = DataFormatter() data_header = [("Engine name", 30), ("IP", 30), ("username", 30), ("protocol", 8), ("port", 5), ("default", 7), ("proxy URL", 30), ("proxy user", 30)] data.create_header(data_header) data.format_type = p_format config = DxConfig() config.init_metadata() if p_engine is None: p_engine = 'all' rows = config.get_engine_info(p_engine, p_username) if rows is None: return -1 for row in rows: data.data_insert(row[0], row[1], row[2], row[4], row[5], row[6], row[8], row[9]) print("") print(data.data_output(False)) print("") return None
def get_list_of_engines(p_engine): logger = logging.getLogger() # read engine from config or read all and put into list config = DxConfig() enginelist = config.get_engine_info(p_engine, None) logger.debug("p_engine %s enginelist %s" % (p_engine, enginelist)) if enginelist is None or len(enginelist) == 0: print_error("Engine name %s not found in configuration" % p_engine) logger.error("Engine name %s not found in configuration" % p_engine) return None else: return enginelist
def get_list_of_engines(p_engine, p_username): logger = logging.getLogger() # read engine from config or read all and put into list config = DxConfig() enginelist = config.get_engine_info(p_engine, p_username) logger.debug("p_engine %s enginelist %s" % (p_engine, enginelist)) if enginelist is None or len(enginelist) == 0: print_error("Engine name %s not found in configuration" % p_engine) logger.error("Engine name %s not found in configuration" % p_engine) return None if p_engine is not None and p_engine.lower() != 'all' and len( enginelist) != 1: print_error("Engine name %s is not unique - add username parameter" % p_engine) logger.error("Engine name %s is not unique - add username parameter" % p_engine) return None else: return enginelist