Esempio n. 1
0
def main():
    options = parse_args()

    log = logging.getLogger()
    # this is general logger level - needs to be
    # debug otherwise it cuts silently everything
    log.setLevel(logging.DEBUG)

    LogHelper.add_console_logger(log, options.loglevel)

    try:
        normalize_passed_arguments(options)
    except RuntimeError as exc:
        msg = "Error occurred during options normalization: {}".format(
            str(exc))
        logging.error(msg)
        sys.exit(1)
    # logging dir needs to be created based on other options
    # thus we have to postprocess it

    logging_dir = get_logging_dir(options)

    LogHelper.add_logging_dir(log, logging_dir)

    options.func(options)
Esempio n. 2
0
def main():
    options = parse_args()

    log = logging.getLogger()
    # this is general logger level - needs to be
    # debug otherwise it cuts silently everything
    log.setLevel(logging.DEBUG)

    try:
        bench_id = xml_operations.infer_benchmark_id_from_component_ref_id(
            options.datastream, options.xccdf_id)
        options.benchmark_id = bench_id
    except RuntimeError as exc:
        msg = "Error inferring benchmark ID: {}".format(str(exc))
        logging.error(msg)
        sys.exit(1)


    LogHelper.add_console_logger(log, options.loglevel)
    # logging dir needs to be created based on other options
    # thus we have to postprocess it
    if 'ALL' in options.target:
        options.target = ['ALL']
    if options.logdir is None:
        # default!
        prefix = options.subparser_name
        body = ""
        if 'ALL' in options.target:
            body = 'ALL'
        else:
            body = 'custom'

        date_string = time.strftime('%Y-%m-%d-%H%M', time.localtime())
        logging_dir = os.path.join(os.getcwd(),
                                   'logs',
                                   '{0}-{1}-{2}'.format(prefix,
                                                        body,
                                                        date_string))
        logging_dir = LogHelper.find_name(logging_dir)
    else:
        logging_dir = LogHelper.find_name(options.logdir)
    LogHelper.add_logging_dir(log, logging_dir)

    options.func(options)
def main():
    options = parse_args()

    log = logging.getLogger()
    # this is general logger level - needs to be
    # debug otherwise it cuts silently everything
    log.setLevel(logging.DEBUG)

    LogHelper.add_console_logger(log, options.loglevel)

    try:
        normalize_passed_arguments(options)
    except RuntimeError as exc:
        msg = "Error occurred during options normalization: {}".format(
            str(exc))
        logging.error(msg)
        sys.exit(1)
    # logging dir needs to be created based on other options
    # thus we have to postprocess it

    logging_dir = get_logging_dir(options)

    LogHelper.add_logging_dir(log, logging_dir)

    with datastream_in_stash(options.datastream) as stashed_datastream:
        options.datastream = stashed_datastream

        with xml_operations.datastream_root(stashed_datastream,
                                            stashed_datastream) as root:
            if options.remove_machine_only:
                xml_operations.remove_machine_platform(root)
                xml_operations.remove_machine_remediation_condition(root)
            if options.remove_ocp4_only:
                xml_operations.remove_ocp4_platforms(root)
            if options.add_platform:
                xml_operations.add_platform_to_benchmark(
                    root, options.add_platform)
            if options.add_product_to_fips_certified:
                xml_operations.add_product_to_fips_certified(
                    root, options.add_product_to_fips_certified)

        options.func(options)
def main():
    options = parse_args()

    log = logging.getLogger()
    # this is general logger level - needs to be
    # debug otherwise it cuts silently everything
    log.setLevel(logging.DEBUG)

    LogHelper.add_console_logger(log, options.loglevel)

    try:
        normalize_passed_arguments(options)
    except RuntimeError as exc:
        msg = "Error occurred during options normalization: {}".format(str(exc))
        logging.error(msg)
        sys.exit(1)
    # logging dir needs to be created based on other options
    # thus we have to postprocess it

    logging_dir = get_logging_dir(options)

    LogHelper.add_logging_dir(log, logging_dir)

    options.func(options)
Esempio n. 5
0
log = logging.getLogger()
# this is general logger level - needs to be
# debug otherwise it cuts silently everything
log.setLevel(logging.DEBUG)

try:
    bench_id = xml_operations.infer_benchmark_id_from_component_ref_id(
        options.datastream, options.xccdf_id)
    options.benchmark_id = bench_id
except RuntimeError as exc:
    msg = "Error inferring benchmark ID: {}".format(str(exc))
    logging.error(msg)
    sys.exit(1)

LogHelper.add_console_logger(log, options.loglevel)
# logging dir needs to be created based on other options
# thus we have to postprocess it
if 'ALL' in options.target:
    options.target = ['ALL']
if options.logdir is None:
    # default!
    prefix = options.subparser_name
    body = ""
    if 'ALL' in options.target:
        body = 'ALL'
    else:
        body = 'custom'

    date_string = time.strftime('%Y-%m-%d-%H%M', time.localtime())
    logging_dir = os.path.join(os.getcwd(), 'logs',
Esempio n. 6
0
log = logging.getLogger()
# this is general logger level - needs to be
# debug otherwise it cuts silently everything
log.setLevel(logging.DEBUG)

try:
    bench_id = xml_operations.infer_benchmark_id_from_component_ref_id(
        options.datastream, options.xccdf_id)
    options.benchmark_id = bench_id
except RuntimeError as exc:
    msg = "Error inferring benchmark ID: {}".format(str(exc))
    logging.error(msg)
    sys.exit(1)


LogHelper.add_console_logger(log, options.loglevel)
# logging dir needs to be created based on other options
# thus we have to postprocess it
if 'ALL' in options.target:
    options.target = ['ALL']
if options.logdir is None:
    # default!
    prefix = options.subparser_name
    body = ""
    if 'ALL' in options.target:
        body = 'ALL'
    else:
        body = 'custom'

    date_string = time.strftime('%Y-%m-%d-%H%M', time.localtime())
    logging_dir = os.path.join(os.getcwd(),