示例#1
0
def read_configs(reporter, skip_wrong_config=False):
    """
    Returns content of all configs present on local system in dictionary,
    where key is name of config and value is its content.

    reporter -- report processor
    skip_wrong_config -- if True skip local configs that are unreadable
    """
    report_list = []
    output = {}
    for file_name in get_all_configs_file_names():
        try:
            output[file_name] = _read_config(file_name)
        except EnvironmentError:
            report_list.append(reports.booth_config_read_error(
                file_name,
                (
                    ReportItemSeverity.WARNING if skip_wrong_config
                    else ReportItemSeverity.ERROR
                ),
                (
                    None if skip_wrong_config
                    else report_codes.SKIP_UNREADABLE_CONFIG
                )
            ))
    reporter.process_list(report_list)
    return output
示例#2
0
def read_configs(reporter, skip_wrong_config=False):
    """
    Returns content of all configs present on local system in dictionary,
    where key is name of config and value is its content.

    reporter -- report processor
    skip_wrong_config -- if True skip local configs that are unreadable
    """
    report_list = []
    output = {}
    for file_name in get_all_configs_file_names():
        try:
            output[file_name] = _read_config(file_name)
        except EnvironmentError:
            report_list.append(reports.booth_config_read_error(
                file_name,
                (
                    ReportItemSeverity.WARNING if skip_wrong_config
                    else ReportItemSeverity.ERROR
                ),
                (
                    None if skip_wrong_config
                    else report_codes.SKIP_UNREADABLE_CONFIG
                )
            ))
    reporter.process_list(report_list)
    return output
示例#3
0
 def test_another_name(self):
     self.assert_message_from_report(
         "Unable to read booth config 'another'",
         reports.booth_config_read_error("another"))
示例#4
0
 def test_booth_name(self):
     self.assert_message_from_report(
         "Unable to read booth config",
         reports.booth_config_read_error("booth"))
示例#5
0
 def test_another_name(self):
     self.assert_message_from_report(
         "Unable to read booth config 'another'",
         reports.booth_config_read_error("another")
     )
示例#6
0
 def test_booth_name(self):
     self.assert_message_from_report(
         "Unable to read booth config",
         reports.booth_config_read_error("booth")
     )