def test_print_dracut_errors(self):
        logger_mock = Mock()

        with patch("pyanaconda.startup_utils.open",
                   mock_open(read_data="test text")) as m:
            print_dracut_errors(logger_mock)

            m.assert_called_once_with("/run/anaconda/initrd_errors.txt", "rt")

            logger_mock.warning.assert_called_once_with(
                dedent("""
                ############## Installer errors encountered during boot ##############
                test text
                ############ Installer errors encountered during boot end ############"""
                       ))
Esempio n. 2
0
    if opts.updates_url:
        log.info("Using updates from: %s", opts.updates_url)

    # warn users that they should use inst. prefix all the time
    for arg in removed_no_inst_args:
        stdout_log.warning(
            "Kernel boot argument '%s' detected. "
            "Did you want to use 'inst.%s' for the installer instead?", arg,
            arg)
    if removed_no_inst_args:
        stdout_log.warning(
            "All Anaconda kernel boot arguments are now required to use "
            "'inst.' prefix!")

    # print errors encountered during boot
    startup_utils.print_dracut_errors(stdout_log)

    from pyanaconda import isys

    util.ipmi_report(constants.IPMI_STARTED)

    if (opts.images or opts.dirinstall) and opts.liveinst:
        stdout_log.error(
            "--liveinst cannot be used with --images or --dirinstall")
        util.ipmi_report(constants.IPMI_ABORTED)
        sys.exit(1)

    if opts.images and opts.dirinstall:
        stdout_log.error(
            "--images and --dirinstall cannot be used at the same time")
        util.ipmi_report(constants.IPMI_ABORTED)
 def test_print_dracut_errors_missing_file(self):
     logger_mock = Mock()
     print_dracut_errors(logger_mock)
     logger_mock.assert_not_called()