Ejemplo n.º 1
0
def testEmptyPostScript():
    reload(userchoices)

    def emptyPostBinSh(argv):
        assert 0, "there is no post-script, so we should not get here"

    fauxroot.EXEC_FUNCTIONS['/bin/sh'] = emptyPostBinSh

    context = applychoices.Context(applychoices.ProgressCallback())
    script.hostActionPostScript(context)

    del fauxroot.EXEC_FUNCTIONS['/bin/sh']
Ejemplo n.º 2
0
    def _execute(self, script):
        from preparser import ScriptedInstallPreparser
        from scriptedinstallutil import Result

        errors = None
        installCompleted = False

        try:
            self.sip = ScriptedInstallPreparser(script)

            (result, errors, warnings) = self.sip.parseAndValidate()
            if warnings:
                log.warn("\n".join(warnings))
            if errors:
                log.error("\n".join(errors))
                userchoices.setReboot(False)
            if result != Result.FAIL:
                # Bring up whatever is needed for the install to happen.  For
                # example, get the network going for non-local installs.
                errors, warnings = self._runtimeActions()

                if warnings:
                    log.warn("\n".join(warnings))
                if errors:
                    log.error("\n".join(errors))
                    userchoices.setReboot(False)

                if not errors:
                    if userchoices.getDebug():
                        log.info(userchoices.dumpToString())

                    if userchoices.getDryrun():
                        log.log(LOGLEVEL_HUMAN, "dry run specified, stopping.")
                    else:
                        context = applychoices.Context(
                            applychoices.ProgressCallback(
                                applychoices.StdoutProgressDelegate()))
                        applychoices.doit(context)
                        installCompleted = True

                media.runtimeActionEjectMedia()
        except IOError, e:
            log.error("error: cannot open file -- %s\n" % str(e))
Ejemplo n.º 3
0
    def __init__(self, controlState, xml):
        self.xml = xml
        self.progressBar = xml.get_widget("InstallationProgressBar")
        self.progressLabel = xml.get_widget("InstallationProgressLabel")
        self.statusLabel = xml.get_widget("InstallationStatusLabel")

        controlState.displayHeaderBar = True
        controlState.windowIcon = 'installing.png'
        controlState.windowTitle = "Installing ESX 4.1"
        controlState.windowText = \
            "ESX 4.1 is being installed; this may take several minutes."

        controlState.setNextButtonEnabled(False)
        controlState.setBackButtonEnabled(False)

        self.controlState = controlState
        self.context = applychoices.Context(
            applychoices.ProgressCallback(self))

        gobject.idle_add(self.installSystem)
Ejemplo n.º 4
0
    def __init__(self, controlState, xml):
        self.xml = xml
        self.progressBar = xml.get_widget("DriverloadProgressBar")
        self.progressLabel = xml.get_widget("DriverloadProgressLabel")
        self.statusLabel = xml.get_widget("DriverloadStatusLabel")

        controlState.displayHeaderBar = True
        controlState.windowIcon = 'driverloading.png'
        controlState.windowTitle = "Loading Drivers"
        controlState.windowText = "The installation wizard will resume " + \
            "after all necessary drivers are loaded"

        controlState.setNextButtonEnabled(False)
        controlState.setBackButtonEnabled(False)

        self.controlState = controlState
        self.context = applychoices.Context(
            applychoices.ProgressCallback(self))

        gobject.idle_add(self.loadDrivers)
Ejemplo n.º 5
0
def testPostScript():
    reload(userchoices)

    # Setup our fake '/bin/sh' executable that just checks its args.
    def postBinSh(argv):
        assert argv[0] == '/bin/sh'
        assert argv[1] == '/tmp/ks-script'
        postBinSh.ran = True

        return 0

    postBinSh.ran = False
    fauxroot.EXEC_FUNCTIONS['/bin/sh'] = postBinSh

    # setup a temporary directory for testing
    tmproot = tempfile.mkdtemp(suffix='test_script')
    try:
        os.makedirs(os.path.join(tmproot, 'mnt/sysimage', 'tmp'))
        os.chroot(tmproot)

        # set a script to run.
        userchoices.addPostScript(
            script.Script(
                '''#! /bin/sh

            echo Hello, World!
            ''', '/bin/sh', True, 0, False))
        context = applychoices.Context(applychoices.ProgressCallback())
        script.hostActionPostScript(context)
        assert postBinSh.ran, "the post script was not run?!"

        assert not os.path.exists(os.path.join(
            'mnt/sysimage', 'tmp', 'ks-script')), \
            "post script was not generated?"
    finally:
        fauxroot.FAUXROOT = None  # clear out our fake chroot

        os.removedirs(os.path.join(tmproot, 'mnt/sysimage', 'tmp'))

        del fauxroot.EXEC_FUNCTIONS['/bin/sh']
Ejemplo n.º 6
0
 def __init__(self):
     super(InstallationWindow, self).__init__()
     self.context = applychoices.Context(
         applychoices.ProgressCallback(
             applychoices.StdoutProgressDelegate()))
     self.substep = self.apply