Beispiel #1
0
    def test_touch(self):
        """Test if the touch function correctly creates empty files"""
        test_dir = tempfile.mkdtemp()
        try:
            file_path = os.path.join(test_dir, "EMPTY_FILE")
            # try to create an empty file with touch()
            util.touch(file_path)

            # check if it exists & is a file
            assert os.path.isfile(file_path)

            # check if the file is empty
            assert os.stat(file_path).st_size == 0
        finally:
            shutil.rmtree(test_dir)
Beispiel #2
0
    def touch_test(self):
        """Test if the touch function correctly creates empty files"""
        test_dir = tempfile.mkdtemp()
        try:
            file_path = os.path.join(test_dir, "EMPTY_FILE")
            # try to create an empty file with touch()
            util.touch(file_path)

            # check if it exists & is a file
            self.assertTrue(os.path.isfile(file_path))

            # check if the file is empty
            self.assertEqual(os.stat(file_path).st_size, 0)
        finally:
            shutil.rmtree(test_dir)
Beispiel #3
0
    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)

    # check if input kickstart should be saved
    if flags.nosave_input_ks:
        log.warning(
            "Input kickstart will not be saved to the installed system due to the nosave option."
        )
        util.touch('/tmp/NOSAVE_INPUT_KS')

    # check if logs should be saved
    if flags.nosave_logs:
        log.warning(
            "Installation logs will not be saved to the installed system due to the nosave option."
        )
        util.touch('/tmp/NOSAVE_LOGS')

    # see if we're on s390x and if we've got an ssh connection
    uname = os.uname()
    if uname[4] == 's390x':
        if 'TMUX' not in os.environ and 'ks' not in flags.cmdline and conf.target.is_hardware:
            startup_utils.prompt_for_ssh()
            sys.exit(0)
Beispiel #4
0
 def _enable_reconfig_mode(self):
     """Write the reconfig mode trigger file."""
     log.debug("Initial Setup reconfiguration mode will be enabled.")
     util.touch(os.path.join(self._sysroot, "etc/reconfigSys"))
Beispiel #5
0
    anaconda_logging.logger.setupVirtio(opts.virtiolog)

    from pyanaconda import network
    network.setup_ifcfg_log()

    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)

    # check if input kickstart should be saved
    if flags.nosave_input_ks:
        log.warning("Input kickstart will not be saved to the installed system due to the nosave option.")
        util.touch('/tmp/NOSAVE_INPUT_KS')

    # check if logs should be saved
    if flags.nosave_logs:
        log.warning("Installation logs will not be saved to the installed system due to the nosave option.")
        util.touch('/tmp/NOSAVE_LOGS')

    # see if we're on s390x and if we've got an ssh connection
    uname = os.uname()
    if uname[4] == 's390x':
        if 'TMUX' not in os.environ and 'ks' not in flags.cmdline and not conf.target.is_image:
            startup_utils.prompt_for_ssh()
            sys.exit(0)

    log.info("%s %s", sys.argv[0], startup_utils.get_anaconda_version_string(build_time_version=True))
    if os.path.exists("/tmp/updates"):