def test_read_storage_stats(input_filename):
    """Parses up to the STORAGE section."""
    target_file = open(input_filename)
    test_dmi = parse_dmidecode.read_dmidecode(target_file)
    test_os = parse_operating_system.read_operating_system(target_file)
    test_cpu_stats = parse_cpu.read_cpu_stats(target_file)
    test_memory_stats = parse_memory.read_memory_stats(target_file)
    test_storage_stats = parse_storage.read_storage_stats(target_file)
    target_output = open('output.yaml', 'w')
    yaml.dump(test_dmi, target_output)
    yaml.dump(test_os, target_output)
    yaml.dump(test_cpu_stats, target_output)
    yaml.dump(test_memory_stats, target_output)
    yaml.dump(test_storage_stats, target_output)
def test_read_lspci(input_filename):
    """Parses up to the LSPCI section."""
    target_file = open(input_filename)
    test_dmi = parse_dmidecode.read_dmidecode(target_file)
    test_os = parse_operating_system.read_operating_system(target_file)
    test_cpu_stats = parse_cpu.read_cpu_stats(target_file)
    test_memory_stats = parse_memory.read_memory_stats(target_file)
    test_storage_stats = parse_storage.read_storage_stats(target_file)
    test_dm_multipath = parse_dm_multipath.parse_dm_multipath(target_file)
    test_lspci = parse_lspci.read_lspci(target_file)
    target_output = open('output.yaml', 'w')
    yaml.dump(test_dmi, target_output)
    yaml.dump(test_os, target_output)
    yaml.dump(test_cpu_stats, target_output)
    yaml.dump(test_memory_stats, target_output)
    yaml.dump(test_storage_stats, target_output)
    yaml.dump(test_dm_multipath, target_output)
    yaml.dump(test_lspci, target_output)
def read_entire_file(input_filename, output_filename):
    """Parses the entire report."""
    target_file = open(input_filename)
    test_dmi = parse_dmidecode.read_dmidecode(target_file)
    test_os = parse_operating_system.read_operating_system(target_file)
    test_cpu_stats = parse_cpu.read_cpu_stats(target_file)
    test_memory_stats = parse_memory.read_memory_stats(target_file)
    test_storage_stats = parse_storage.read_storage_stats(target_file)
    test_dm_multipath = parse_dm_multipath.parse_dm_multipath(target_file)
    test_lspci = parse_lspci.read_lspci(target_file)
    test_ethtool = parse_ethtool.read_ethtool(target_file)
    target_output = open(output_filename, 'w')
    yaml.dump(test_dmi, target_output)
    yaml.dump(test_os, target_output)
    yaml.dump(test_cpu_stats, target_output)
    yaml.dump(test_memory_stats, target_output)
    yaml.dump(test_storage_stats, target_output)
    yaml.dump(test_dm_multipath, target_output)
    yaml.dump(test_lspci, target_output)
    yaml.dump(test_ethtool, target_output)
Beispiel #4
0
def read_entire_file(input_filename, output_filename):
    """Parses the entire report."""
    target_file = open(input_filename)
    test_dmi = parse_dmidecode.read_dmidecode(target_file)
    test_os = parse_operating_system.read_operating_system(target_file)
    test_cpu_stats = parse_cpu.read_cpu_stats(target_file)
    test_memory_stats = parse_memory.read_memory_stats(target_file)
    test_storage_stats = parse_storage.read_storage_stats(target_file)
    test_dm_multipath = parse_dm_multipath.parse_dm_multipath(target_file)
    test_lspci = parse_lspci.read_lspci(target_file)
    test_ethtool = parse_ethtool.read_ethtool(target_file)
    target_output = open(output_filename, 'w')
    test_list = [
        test_dmi, test_os, test_cpu_stats, test_memory_stats,
        test_storage_stats, test_dm_multipath, test_lspci, test_ethtool
    ]
    for test in test_list:
        target_output.write("---\n")
        yaml.dump(test, Dumper=CustomDumper, stream=target_output)
    target_output.close()