Example #1
0
    def test_set_from_requested_profile(self):
        conf = AnacondaConfiguration.from_defaults()

        # Test an unknown requested profile.
        with self.assertRaises(ConfigurationError) as cm:
            conf.set_from_profile("unknown-profile")

        expected = "Unable to find any suitable configuration files " \
                   "for the 'unknown-profile' profile."

        self.assertEqual(str(cm.exception), expected)

        # Test a known requested profile.
        conf.set_from_profile("fedora-workstation")

        self._check_configuration_sources(conf, [
            "anaconda.conf", "profile.d/fedora.conf",
            "profile.d/fedora-workstation.conf"
        ])
Example #2
0
    from pyanaconda.core.kernel import kernel_arguments
    (opts,
     removed_no_inst_args) = parse_arguments(boot_cmdline=kernel_arguments)

    from pyanaconda.core.configuration.anaconda import conf
    conf.set_from_opts(opts)

    # Set up logging as early as possible.
    from pyanaconda import anaconda_logging
    from pyanaconda import anaconda_loggers
    anaconda_logging.init(write_to_journal=conf.target.is_hardware)
    anaconda_logging.logger.setupVirtio(opts.virtiolog)

    # Load the remaining configuration after a logging is set up.
    if opts.profile_id:
        conf.set_from_profile(opts.profile_id, )
    else:
        conf.set_from_detected_profile(
            util.get_os_release_value("ID"),
            util.get_os_release_value("VARIANT_ID"),
        )

    conf.set_from_files()
    conf.set_from_opts(opts)

    log = anaconda_loggers.get_main_logger()
    stdout_log = anaconda_loggers.get_stdout_logger()

    if os.geteuid() != 0:
        stdout_log.error("anaconda must be run as root.")
        sys.exit(1)