Exemplo n.º 1
0
def get_ltop_list():
    ltop_data_list = {}
    ltop_handler_var = ltop_handler()
    ltop_handler_var.parse(conf_tool.get_base_path() + os.path.sep +
                           conf_tool.get_ltop_file_path())
    ltop_data_list['ostlist'] = ltop_handler_var.ltop_ost_list
    ltop_data_list['mdtlist'] = ltop_handler_var.ltop_mdt_list
    return ltop_data_list
Exemplo n.º 2
0
def get_ltop_list():
    ltop_data_list = {}
    ltop_handler_var = ltop_handler()
    ltop_handler_var.parse(conf_tool.get_base_path() + os.path.sep +
                           conf_tool.get_ltop_file_path())
    ltop_data_list['ostlist'] = ltop_handler_var.ltop_ost_list
    ltop_data_list['mdtlist'] = ltop_handler_var.ltop_mdt_list
    print("total_lines:%d, invalid_lines:%d, repeated_lines:%d" %
          (ltop_handler_var.total_lines, ltop_handler_var.invalid_lines,
           ltop_handler_var.repeated_lines))
    return ltop_data_list
Exemplo n.º 3
0
def ltop_file_filter():
    ltop_file_path = conf_tool.get_base_path(
    ) + os.path.sep + conf_tool.get_ltop_file_path()
    filtered_content = ''
    with open(ltop_file_path, "r+") as ltop_file:
        line_str = ltop_file.readline()
        while line_str:
            if line_str and ("OST" in line_str or "ost" in line_str
                             or "MDT" in line_str or "mdt" in line_str):
                filtered_content += line_str
            line_str = ltop_file.readline()
    with open(ltop_file_path, "w") as ltop_file:
        ltop_file.write(filtered_content)
Exemplo n.º 4
0
def read_etc_hosts():
    doc = minidom.parse((conf_tool.get_base_path() + os.path.sep + conf_tool.get_etc_hosts_path()))
    host_handler = etc_host_handler(doc)
    return host_handler.xml_to_hosts()
Exemplo n.º 5
0
def write_etc_hosts(hosts_set):
    doc = minidom.Document()
    with open((conf_tool.get_base_path() + os.path.sep + conf_tool.get_etc_hosts_path()), "w") as f:
        host_handler = etc_host_handler(doc)
        host_handler.hosts_to_xml(hosts_set).writexml(f)
Exemplo n.º 6
0
def get_ltop_mdtlist():
    ltop_handler_var = ltop_handler()
    ltop_handler_var.parse_mdt(conf_tool.get_base_path() + os.path.sep +
                               conf_tool.get_ltop_file_path())
    return ltop_handler_var.ltop_mdt_list