コード例 #1
0
ファイル: progress.py プロジェクト: nullr0ute/anaconda
    def refresh(self, args=None):
        from pyanaconda.install import doInstall, doConfiguration
        from pyanaconda.threads import threadMgr, AnacondaThread

        # We print this here because we don't really use the window object
        print(_(self.title))

        threadMgr.add(AnacondaThread(name=THREAD_INSTALL, target=doInstall,
                                     args=(self.storage, self.payload, self.data,
                                           self.instclass)))

        # This will run until we're all done with the install thread.
        self._update_progress()

        threadMgr.add(AnacondaThread(name=THREAD_CONFIGURATION, target=doConfiguration,
                                     args=(self.storage, self.payload, self.data,
                                           self.instclass)))

        # This will run until we're all done with the configuration thread.
        self._update_progress()

        iutil.ipmi_report(IPMI_FINISHED)

        # kickstart install, continue automatically if reboot or shutdown selected
        if flags.automatedInstall and self.data.reboot.action in [KS_REBOOT, KS_SHUTDOWN]:
            # Just pretend like we got input, and our input doesn't care
            # what it gets, it just quits.
            self.input(None, None)

        return True
コード例 #2
0
ファイル: progress.py プロジェクト: NealSCarffery/anaconda
    def refresh(self, args=None):
        from pyanaconda.install import doInstall, doConfiguration
        from pyanaconda.threads import threadMgr, AnacondaThread

        # We print this here because we don't really use the window object
        print(_(self.title))

        threadMgr.add(AnacondaThread(name=THREAD_INSTALL, target=doInstall,
                                     args=(self.storage, self.payload, self.data,
                                           self.instclass)))

        # This will run until we're all done with the install thread.
        self._update_progress()

        threadMgr.add(AnacondaThread(name=THREAD_CONFIGURATION, target=doConfiguration,
                                     args=(self.storage, self.payload, self.data,
                                           self.instclass)))

        # This will run until we're all done with the configuration thread.
        self._update_progress()

        iutil.ipmi_report(IPMI_FINISHED)

        # kickstart install, continue automatically if reboot or shutdown selected
        if flags.automatedInstall and self.data.reboot.action in [KS_REBOOT, KS_SHUTDOWN]:
            # Just pretend like we got input, and our input doesn't care
            # what it gets, it just quits.
            self.input(None, None)

        return True
コード例 #3
0
ファイル: storage.py プロジェクト: jresch/anaconda
    def on_info_bar_clicked(self, *args):
        if self.errors:
            label = _("The following errors were encountered when checking your storage "
                      "configuration.  You can modify your storage layout or quit the "
                      "installer.")

            dialog = DetailedErrorDialog(self.data, buttons=[
                    C_("GUI|Storage|Error Dialog", "_Quit"),
                    C_("GUI|Storage|Error Dialog", "_Modify Storage Layout")],
                label=label)
            with self.main_window.enlightbox(dialog.window):
                errors = "\n".join(self.errors)
                dialog.refresh(errors)
                rc = dialog.run()

            dialog.window.destroy()

            if rc == 0:
                # Quit.
                sys.exit(0)
                iutil.ipmi_report(constants.IPMI_ABORTED)
        elif self.warnings:
            label = _("The following warnings were encountered when checking your storage "
                      "configuration.  These are not fatal, but you may wish to make "
                      "changes to your storage layout.")

            dialog = DetailedErrorDialog(self.data, buttons=[_("_OK")], label=label)
            with self.main_window.enlightbox(dialog.window):
                warnings = "\n".join(self.warnings)
                dialog.refresh(warnings)
                rc = dialog.run()

            dialog.window.destroy()
コード例 #4
0
    def on_info_bar_clicked(self, *args):
        if not self._errorMsgs:
            return

        label = _("The software marked for installation has the following errors.  "
                  "This is likely caused by an error with your installation source.  "
                  "You can quit the installer, change your software source, or change "
                  "your software selections.")
        dialog = DetailedErrorDialog(self.data,
                buttons=[C_("GUI|Software Selection|Error Dialog", "_Quit"),
                         C_("GUI|Software Selection|Error Dialog", "_Modify Software Source"),
                         C_("GUI|Software Selection|Error Dialog", "Modify _Selections")],
                label=label)
        with self.main_window.enlightbox(dialog.window):
            dialog.refresh(self._errorMsgs)
            rc = dialog.run()

        dialog.window.destroy()

        if rc == 0:
            # Quit.
            iutil.ipmi_report(constants.IPMI_ABORTED)
            sys.exit(0)
        elif rc == 1:
            # Send the user to the installation source spoke.
            self.skipTo = "SourceSpoke"
            self.window.emit("button-clicked")
        elif rc == 2:
            # Close the dialog so the user can change selections.
            pass
        else:
            pass
コード例 #5
0
ファイル: askvnc.py プロジェクト: thaygiaoth/anaconda
    def input(self, args, key):
        """Override input so that we can launch the VNC password spoke"""

        try:
            keyid = int(key) - 1
            if 0 <= keyid < len(self._choices):
                choice = self._choices[keyid]
                if choice == _(USETEXT):
                    self._usevnc = False
                else:
                    self._usevnc = True
                    newspoke = VNCPassSpoke(self.app, self.data, self.storage,
                                            self.payload, self.instclass)
                    self.app.switch_screen_modal(newspoke)

                self.apply()
                self.close()
            return INPUT_PROCESSED
        except ValueError:
            pass

        # TRANSLATORS: 'q' to quit
        if key.lower() == C_('TUI|Spoke Navigation', 'q'):
            d = YesNoDialog(self.app, _(self.app.quit_message))
            self.app.switch_screen_modal(d)
            if d.answer:
                iutil.ipmi_report(IPMI_ABORTED)
                if can_touch_runtime_system("Quit and Reboot"):
                    execWithRedirect("systemctl", ["--no-wall", "reboot"])
                else:
                    exit(1)
        else:
            return key
コード例 #6
0
    def connectToView(self):
        """Attempt to connect to self.vncconnecthost"""

        maxTries = 10
        self.log.info(_("Attempting to connect to vnc client on host %s..."), self.vncconnecthost)

        if self.vncconnectport != "":
            hostarg = self.vncconnecthost + ":" + self.vncconnectport
        else:
            hostarg = self.vncconnecthost

        vncconfigcommand = [self.root+"/usr/bin/vncconfig", "-display", ":%s" % constants.X_DISPLAY_NUMBER, "-connect", hostarg]

        for _i in range(maxTries):
            vncconfp = iutil.startProgram(vncconfigcommand, stdout=subprocess.PIPE, stderr=subprocess.PIPE) # vncconfig process
            err = vncconfp.communicate()[1].decode("utf-8")

            if err == '':
                self.log.info(_("Connected!"))
                return True
            elif err.startswith("connecting") and err.endswith("failed\n"):
                self.log.info(_("Will try to connect again in 15 seconds..."))
                time.sleep(15)
                continue
            else:
                log.critical(err)
                iutil.ipmi_report(constants.IPMI_ABORTED)
                sys.exit(1)
        self.log.error(P_("Giving up attempting to connect after %d try!\n",
                          "Giving up attempting to connect after %d tries!\n",
                          maxTries), maxTries)
        return False
コード例 #7
0
ファイル: software.py プロジェクト: KosiehBarter/anaconda
    def on_info_bar_clicked(self, *args):
        if not self._errorMsgs:
            return

        label = _("The software marked for installation has the following errors.  "
                  "This is likely caused by an error with your installation source.  "
                  "You can quit the installer, change your software source, or change "
                  "your software selections.")
        dialog = DetailedErrorDialog(self.data,
                buttons=[C_("GUI|Software Selection|Error Dialog", "_Quit"),
                         C_("GUI|Software Selection|Error Dialog", "_Modify Software Source"),
                         C_("GUI|Software Selection|Error Dialog", "Modify _Selections")],
                label=label)
        with self.main_window.enlightbox(dialog.window):
            dialog.refresh(self._errorMsgs)
            rc = dialog.run()

        dialog.window.destroy()

        if rc == 0:
            # Quit.
            iutil.ipmi_report(constants.IPMI_ABORTED)
            sys.exit(0)
        elif rc == 1:
            # Send the user to the installation source spoke.
            self.skipTo = "SourceSpoke"
            self.window.emit("button-clicked")
        elif rc == 2:
            # Close the dialog so the user can change selections.
            pass
        else:
            pass
コード例 #8
0
ファイル: tuiobject.py プロジェクト: mudler/anaconda
    def input(self, args, key):
        """This dialog is closed by any input.

        And causes the program to quit.
        """
        iutil.ipmi_report(constants.IPMI_ABORTED)
        sys.exit(1)
コード例 #9
0
ファイル: askvnc.py プロジェクト: megaumi/anaconda
    def input(self, args, key):
        """Override input so that we can launch the VNC password spoke"""

        try:
            keyid = int(key) - 1
            if 0 <= keyid < len(self._choices):
                choice = self._choices[keyid]
                if choice == _(USETEXT):
                    self._usevnc = False
                else:
                    self._usevnc = True
                    newspoke = VNCPassSpoke(self.app, self.data, self.storage,
                                            self.payload, self.instclass)
                    self.app.switch_screen_modal(newspoke)

                self.apply()
                self.close()
            return INPUT_PROCESSED
        except ValueError:
            pass

        if key.lower() == _('q'):
            d = YesNoDialog(self.app, _(self.app.quit_message))
            self.app.switch_screen_modal(d)
            if d.answer:
                iutil.ipmi_report(IPMI_ABORTED)
                if can_touch_runtime_system("Quit and Reboot"):
                    execWithRedirect("systemctl", ["--no-wall", "reboot"])
                else:
                    exit(1)
        else:
            return key
コード例 #10
0
ファイル: welcome.py プロジェクト: KosiehBarter/anaconda
    def _on_continue_clicked(self, window, user_data=None):
        # Don't display the betanag dialog if this is the final release.
        if not isFinal:
            dlg = self.builder.get_object("betaWarnDialog")
            with self.main_window.enlightbox(dlg):
                rc = dlg.run()
                dlg.destroy()
            if rc != 1:
                ipmi_report(IPMI_ABORTED)
                sys.exit(0)

        if (
            productName.startswith("Red Hat ")
            and is_unsupported_hw()
            and not self.data.unsupportedhardware.unsupported_hardware
        ):
            dlg = self.builder.get_object("unsupportedHardwareDialog")
            with self.main_window.enlightbox(dlg):
                rc = dlg.run()
                dlg.destroy()
            if rc != 1:
                ipmi_report(IPMI_ABORTED)
                sys.exit(0)

        StandaloneSpoke._on_continue_clicked(self, window, user_data)
コード例 #11
0
ファイル: tuiobject.py プロジェクト: Jakuje/anaconda
    def input(self, args, key):
        """This dialog is closed by any input.

        And causes the program to quit.
        """
        iutil.ipmi_report(constants.IPMI_ABORTED)
        sys.exit(1)
コード例 #12
0
ファイル: progress.py プロジェクト: NealSCarffery/anaconda
    def _configuration_done(self):
        # Configuration done, remove ransom notes timer
        # and switch to the Reboot page

        GLib.source_remove(self._rnotes_id)
        self._progressNotebook.set_current_page(1)

        iutil.ipmi_report(IPMI_FINISHED)

        # kickstart install, continue automatically if reboot or shutdown selected
        if flags.automatedInstall and self.data.reboot.action in [KS_REBOOT, KS_SHUTDOWN]:
            self.window.emit("continue-clicked")
コード例 #13
0
ファイル: base.py プロジェクト: jresch/anaconda
    def input(self, args, key):
        """Method called internally to process unhandled input key presses.
        Also handles the main quit and close commands.

        :param args: optional argument passed from switch_screen calls
        :type args: anything

        :param key: the string entered by user
        :type key: str

        :return: True if key was processed, False if it was not recognized
        :rtype: True|False

        """

        # delegate the handling to active screen first
        if self._screens:
            try:
                key = self._screens[-1][0].input(args, key)
                if key is None:
                    return True
            except ExitMainLoop:
                raise
            except Exception:    # pylint: disable=broad-except
                send_exception(self.queue_instance, sys.exc_info())
                return False

        # global refresh command
        # TRANSLATORS: 'r' to refresh
        if self._screens and (key == C_('TUI|Spoke Navigation', 'r')):
            self._do_redraw()
            return True

        # global close command
        # TRANSLATORS: 'c' to continue
        if self._screens and (key == C_('TUI|Spoke Navigation', 'c')):
            self.close_screen()
            return True

        # global quit command
        # TRANSLATORS: 'q' to quit
        elif self._screens and (key == C_('TUI|Spoke Navigation', 'q')):
            if self.quit_question:
                d = self.quit_question(self, _(self.quit_message))
                self.switch_screen_modal(d)
                if d.answer:
                    raise ExitAllMainLoops()

            iutil.ipmi_report(constants.IPMI_ABORTED)
            return True

        return False
コード例 #14
0
ファイル: base.py プロジェクト: yaneti/anaconda
    def input(self, args, key):
        """Method called internally to process unhandled input key presses.
        Also handles the main quit and close commands.

        :param args: optional argument passed from switch_screen calls
        :type args: anything

        :param key: the string entered by user
        :type key: str

        :return: True if key was processed, False if it was not recognized
        :rtype: True|False

        """

        # delegate the handling to active screen first
        if self._screens:
            try:
                key = self._screens[-1][0].input(args, key)
                if key is None:
                    return True
            except ExitMainLoop:
                raise
            except Exception:  # pylint: disable=broad-except
                send_exception(self.queue_instance, sys.exc_info())
                return False

        # global refresh command
        # TRANSLATORS: 'r' to refresh
        if self._screens and (key == C_('TUI|Spoke Navigation', 'r')):
            self._do_redraw()
            return True

        # global close command
        # TRANSLATORS: 'c' to continue
        if self._screens and (key == C_('TUI|Spoke Navigation', 'c')):
            self.close_screen()
            return True

        # global quit command
        # TRANSLATORS: 'q' to quit
        elif self._screens and (key == C_('TUI|Spoke Navigation', 'q')):
            if self.quit_question:
                d = self.quit_question(self, _(self.quit_message))
                self.switch_screen_modal(d)
                if d.answer:
                    raise ExitAllMainLoops()

            iutil.ipmi_report(constants.IPMI_ABORTED)
            return True

        return False
コード例 #15
0
ファイル: __init__.py プロジェクト: cyclefusion/anaconda
    def _on_quit_clicked(self, win, userData=None):
        if not win.get_quit_button():
            return

        dialog = self._quitDialog(None)
        with self.mainWindow.enlightbox(dialog.window):
            rc = dialog.run()
            dialog.window.destroy()

        if rc == 1:
            self._currentAction.exit_logger()
            iutil.ipmi_report(IPMI_ABORTED)
            sys.exit(0)
コード例 #16
0
    def _on_quit_clicked(self, win, userData=None):
        if not win.get_quit_button():
            return

        dialog = self._quitDialog(None)
        with self.mainWindow.enlightbox(dialog.window):
            rc = dialog.run()
            dialog.window.destroy()

        if rc == 1:
            self._currentAction.exit_logger()
            iutil.ipmi_report(IPMI_ABORTED)
            sys.exit(0)
コード例 #17
0
    def _configuration_done(self):
        # Configuration done, remove ransom notes timer
        # and switch to the Reboot page

        GLib.source_remove(self._rnotes_id)
        self._progressNotebook.set_current_page(1)

        iutil.ipmi_report(IPMI_FINISHED)

        # kickstart install, continue automatically if reboot or shutdown selected
        if flags.automatedInstall and self.data.reboot.action in [
                KS_REBOOT, KS_SHUTDOWN
        ]:
            self.window.emit("continue-clicked")
コード例 #18
0
ファイル: startup_utils.py プロジェクト: mariannecx/anaconda
def parse_kickstart(options, addon_paths):
    """Parse the input kickstart.

    If we were given a kickstart file, parse (but do not execute) that now.
    Otherwise, load in defaults from kickstart files shipped with the
    installation media. Pick up any changes from interactive-defaults.ks
    that would otherwise be covered by the dracut KS parser.

    :param options: command line/boot options
    :param dict addon_paths: addon paths dictionary
    :returns: kickstart parsed to a data model
    """
    ksdata = None
    if options.ksfile and not options.liveinst:
        if not os.path.exists(options.ksfile):
            stdout_log.error("Kickstart file %s is missing.", options.ksfile)
            iutil.ipmi_report(constants.IPMI_ABORTED)
            sys.exit(1)

        flags.automatedInstall = True
        flags.eject = False
        ks_files = [options.ksfile]
    elif os.path.exists("/run/install/ks.cfg") and not options.liveinst:
        # this is to handle such cases where a user has pre-loaded a
        # ks.cfg onto an OEMDRV labeled device
        flags.automatedInstall = True
        flags.eject = False
        ks_files = ["/run/install/ks.cfg"]
    else:
        ks_files = [
            "/tmp/updates/interactive-defaults.ks",
            "/usr/share/anaconda/interactive-defaults.ks"
        ]

    for ks in ks_files:
        if not os.path.exists(ks):
            continue

        kickstart.preScriptPass(ks)
        log.info("Parsing kickstart: " + ks)
        ksdata = kickstart.parseKickstart(ks, options.ksstrict)

        # Only load the first defaults file we find.
        break

    if not ksdata:
        ksdata = kickstart.AnacondaKSHandler(addon_paths["ks"])

    return ksdata
コード例 #19
0
ファイル: startup_utils.py プロジェクト: dougsland/anaconda
def parse_kickstart(options, addon_paths):
    """Parse the input kickstart.

    If we were given a kickstart file, parse (but do not execute) that now.
    Otherwise, load in defaults from kickstart files shipped with the
    installation media. Pick up any changes from interactive-defaults.ks
    that would otherwise be covered by the dracut KS parser.

    :param options: command line/boot options
    :param dict addon_paths: addon paths dictionary
    :returns: kickstart parsed to a data model
    """
    ksdata = None
    if options.ksfile and not options.liveinst:
        if not os.path.exists(options.ksfile):
            stdout_log.error("Kickstart file %s is missing.", options.ksfile)
            iutil.ipmi_report(constants.IPMI_ABORTED)
            sys.exit(1)

        flags.automatedInstall = True
        flags.eject = False
        ks_files = [options.ksfile]
    elif os.path.exists("/run/install/ks.cfg") and not options.liveinst:
        # this is to handle such cases where a user has pre-loaded a
        # ks.cfg onto an OEMDRV labeled device
        flags.automatedInstall = True
        flags.eject = False
        ks_files = ["/run/install/ks.cfg"]
    else:
        ks_files = ["/tmp/updates/interactive-defaults.ks",
                    "/usr/share/anaconda/interactive-defaults.ks"]

    for ks in ks_files:
        if not os.path.exists(ks):
            continue

        kickstart.preScriptPass(ks)
        log.info("Parsing kickstart: " + ks)
        ksdata = kickstart.parseKickstart(ks, options.ksstrict)

        # Only load the first defaults file we find.
        break

    if not ksdata:
        ksdata = kickstart.AnacondaKSHandler(addon_paths["ks"])

    return ksdata
コード例 #20
0
ファイル: startup_utils.py プロジェクト: mariannecx/anaconda
def prompt_for_ssh():
    """Prompt the user to ssh to the installation environment on the s390."""

    # Do some work here to get the ip addr / hostname to pass
    # to the user.
    import socket

    ip = network.getFirstRealIP()

    if not ip:
        stdout_log.error(
            "No IP addresses found, cannot continue installation.")
        iutil.ipmi_report(constants.IPMI_ABORTED)
        sys.exit(1)

    ipstr = ip

    try:
        hinfo = socket.gethostbyaddr(ipstr)
    except socket.herror as e:
        stdout_log.debug("Exception caught trying to get host name of %s: %s",
                         ipstr, e)
        name = network.getHostname()
    else:
        if len(hinfo) == 3:
            name = hinfo[0]

    if ip.find(':') != -1:
        ipstr = "[%s]" % (ip, )

    if (name is not None) and (not name.startswith('localhost')) and (
            ipstr is not None):
        connxinfo = "%s (%s)" % (
            socket.getfqdn(name=name),
            ipstr,
        )
    elif ipstr is not None:
        connxinfo = "%s" % (ipstr, )
    else:
        connxinfo = None

    if connxinfo:
        stdout_log.info(_("Please ssh install@%s to begin the install."),
                        connxinfo)
    else:
        stdout_log.info(
            _("Please ssh install@HOSTNAME to continue installation."))
コード例 #21
0
ファイル: exception.py プロジェクト: josefbacik/anaconda
    def postWriteHook(self, dump_info):
        anaconda = dump_info.object

        # See if there is a /root present in the root path and put exception there as well
        if os.access(iutil.getSysroot() + "/root", os.X_OK):
            try:
                dest = iutil.getSysroot() + "/root/%s" % os.path.basename(self.exnFile)
                shutil.copyfile(self.exnFile, dest)
            except (shutil.Error, IOError):
                log.error("Failed to copy %s to %s/root", self.exnFile, iutil.getSysroot())

        # run kickstart traceback scripts (if necessary)
        try:
            kickstart.runTracebackScripts(anaconda.ksdata.scripts)
        # pylint: disable=bare-except
        except:
            pass

        iutil.ipmi_report(IPMI_FAILED)
コード例 #22
0
    def postWriteHook(self, dump_info):
        anaconda = dump_info.object

        # See if there is a /root present in the root path and put exception there as well
        if os.access(iutil.getSysroot() + "/root", os.X_OK):
            try:
                dest = iutil.getSysroot() + "/root/%s" % os.path.basename(self.exnFile)
                shutil.copyfile(self.exnFile, dest)
            except (shutil.Error, IOError):
                log.error("Failed to copy %s to %s/root", self.exnFile, iutil.getSysroot())

        # run kickstart traceback scripts (if necessary)
        try:
            kickstart.runTracebackScripts(anaconda.ksdata.scripts)
        # pylint: disable=bare-except
        except:
            pass

        iutil.ipmi_report(IPMI_FAILED)
コード例 #23
0
    def _configuration_done(self):
        # Configuration done, remove ransom notes timer
        # and switch to the Reboot page

        GLib.source_remove(self._rnotes_id)
        self._progressNotebook.set_current_page(1)
        self.window.set_may_continue(True)

        iutil.ipmi_report(IPMI_FINISHED)

        self.set_warning(
            _("Use of this product is subject to the license agreement found at %s"
              ) % eulaLocation)
        self.window.show_all()

        # kickstart install, continue automatically if reboot or shutdown selected
        if flags.automatedInstall and self.data.reboot.action in [
                KS_REBOOT, KS_SHUTDOWN
        ]:
            self.window.emit("continue-clicked")
コード例 #24
0
    def on_info_bar_clicked(self, *args):
        if self.errors:
            label = _(
                "The following errors were encountered when checking your storage "
                "configuration.  You can modify your storage layout or quit the "
                "installer.")

            dialog = DetailedErrorDialog(self.data,
                                         buttons=[
                                             C_("GUI|Storage|Error Dialog",
                                                "_Quit"),
                                             C_("GUI|Storage|Error Dialog",
                                                "_Modify Storage Layout")
                                         ],
                                         label=label)
            with self.main_window.enlightbox(dialog.window):
                errors = "\n".join(self.errors)
                dialog.refresh(errors)
                rc = dialog.run()

            dialog.window.destroy()

            if rc == 0:
                # Quit.
                sys.exit(0)
                iutil.ipmi_report(constants.IPMI_ABORTED)
        elif self.warnings:
            label = _(
                "The following warnings were encountered when checking your storage "
                "configuration.  These are not fatal, but you may wish to make "
                "changes to your storage layout.")

            dialog = DetailedErrorDialog(self.data,
                                         buttons=[_("_OK")],
                                         label=label)
            with self.main_window.enlightbox(dialog.window):
                warnings = "\n".join(self.warnings)
                dialog.refresh(warnings)
                rc = dialog.run()

            dialog.window.destroy()
コード例 #25
0
ファイル: startup_utils.py プロジェクト: dougsland/anaconda
def prompt_for_ssh():
    """Prompt the user to ssh to the installation environment on the s390."""

    # Do some work here to get the ip addr / hostname to pass
    # to the user.
    import socket

    ip = network.getFirstRealIP()

    if not ip:
        stdout_log.error("No IP addresses found, cannot continue installation.")
        iutil.ipmi_report(constants.IPMI_ABORTED)
        sys.exit(1)

    ipstr = ip

    try:
        hinfo = socket.gethostbyaddr(ipstr)
    except socket.herror as e:
        stdout_log.debug("Exception caught trying to get host name of %s: %s", ipstr, e)
        name = network.getHostname()
    else:
        if len(hinfo) == 3:
            name = hinfo[0]

    if ip.find(':') != -1:
        ipstr = "[%s]" % (ip,)

    if (name is not None) and (not name.startswith('localhost')) and (ipstr is not None):
        connxinfo = "%s (%s)" % (socket.getfqdn(name=name), ipstr,)
    elif ipstr is not None:
        connxinfo = "%s" % (ipstr,)
    else:
        connxinfo = None

    if connxinfo:
        stdout_log.info(_("Please ssh install@%s to begin the install."), connxinfo)
    else:
        stdout_log.info(_("Please ssh install@HOSTNAME to continue installation."))
コード例 #26
0
    def _on_continue_clicked(self, window, user_data=None):
        # Don't display the betanag dialog if this is the final release.
        if not isFinal:
            dlg = self.builder.get_object("betaWarnDialog")
            with self.main_window.enlightbox(dlg):
                rc = dlg.run()
                dlg.destroy()
            if rc != 1:
                ipmi_report(IPMI_ABORTED)
                sys.exit(0)

        if productName.startswith("Red Hat ") and \
          is_unsupported_hw() and not self.data.unsupportedhardware.unsupported_hardware:
            dlg = self.builder.get_object("unsupportedHardwareDialog")
            with self.main_window.enlightbox(dlg):
                rc = dlg.run()
                dlg.destroy()
            if rc != 1:
                ipmi_report(IPMI_ABORTED)
                sys.exit(0)

        StandaloneSpoke._on_continue_clicked(self, window, user_data)
コード例 #27
0
    def show_all(self):
        super().show_all()
        from pyanaconda.installation import doInstall, doConfiguration
        from pyanaconda.threading import threadMgr, AnacondaThread

        thread_args = (self.storage, self.payload, self.data, self.instclass)

        threadMgr.add(AnacondaThread(name=THREAD_INSTALL, target=doInstall, args=thread_args))

        # This will run until we're all done with the install thread.
        self._update_progress()

        threadMgr.add(AnacondaThread(name=THREAD_CONFIGURATION, target=doConfiguration, args=thread_args))

        # This will run until we're all done with the configuration thread.
        self._update_progress()

        iutil.ipmi_report(IPMI_FINISHED)

        # kickstart install, continue automatically if reboot or shutdown selected
        if flags.automatedInstall and self.data.reboot.action in [KS_REBOOT, KS_SHUTDOWN]:
            # Just pretend like we got input, and our input doesn't care
            # what it gets, it just quits.
            raise ExitMainLoop()
コード例 #28
0
    def install(self):
        mainctx = GLib.MainContext.new()
        mainctx.push_thread_default()

        cancellable = None
        gi.require_version("OSTree", "1.0")
        from gi.repository import OSTree
        ostreesetup = self.data.ostreesetup
        log.info("executing ostreesetup=%r", ostreesetup)

        # Initialize the filesystem - this will create the repo as well
        self._safeExecWithRedirect("ostree", [
            "admin", "--sysroot=" + iutil.getTargetPhysicalRoot(), "init-fs",
            iutil.getTargetPhysicalRoot()
        ])

        self._sysroot_path = Gio.File.new_for_path(
            iutil.getTargetPhysicalRoot())

        sysroot = OSTree.Sysroot.new(self._sysroot_path)
        sysroot.load(cancellable)
        repo = sysroot.get_repo(None)[1]
        # We don't support resuming from interrupted installs
        repo.set_disable_fsync(True)

        self._remoteOptions = {}

        if hasattr(ostreesetup, 'nogpg') and ostreesetup.nogpg:
            self._remoteOptions['gpg-verify'] = GLib.Variant('b', False)

        if flags.noverifyssl:
            self._remoteOptions['tls-permissive'] = GLib.Variant('b', True)

        repo.remote_change(None, OSTree.RepoRemoteChange.ADD_IF_NOT_EXISTS,
                           ostreesetup.remote, ostreesetup.url,
                           GLib.Variant('a{sv}',
                                        self._remoteOptions), cancellable)

        progressQ.send_message(_("Starting pull of %(branchName)s from %(source)s") % \
                               {"branchName": ostreesetup.ref, "source": ostreesetup.remote})

        progress = OSTree.AsyncProgress.new()
        progress.connect('changed', self._pullProgressCb)

        try:
            repo.pull(ostreesetup.remote, [ostreesetup.ref], 0, progress,
                      cancellable)
        except GLib.GError as e:
            exn = PayloadInstallError("Failed to pull from repository: %s" % e)
            log.error(str(exn))
            if errors.errorHandler.cb(exn) == errors.ERROR_RAISE:
                progressQ.send_quit(1)
                iutil.ipmi_report(constants.IPMI_ABORTED)
                sys.exit(1)

        progressQ.send_message(
            _("Preparing deployment of %s") % (ostreesetup.ref, ))

        # Now that we have the data pulled, delete the remote for now.
        # This will allow a remote configuration defined in the tree
        # (if any) to override what's in the kickstart.  Otherwise,
        # we'll re-add it in post.  Ideally, ostree would support a
        # pull without adding a remote, but that would get quite
        # complex.
        repo.remote_delete(self.data.ostreesetup.remote, None)

        self._safeExecWithRedirect("ostree", [
            "admin", "--sysroot=" + iutil.getTargetPhysicalRoot(), "os-init",
            ostreesetup.osname
        ])

        admin_deploy_args = [
            "admin", "--sysroot=" + iutil.getTargetPhysicalRoot(), "deploy",
            "--os=" + ostreesetup.osname
        ]

        admin_deploy_args.append(ostreesetup.remote + ':' + ostreesetup.ref)

        log.info("ostree admin deploy starting")
        progressQ.send_message(
            _("Deployment starting: %s") % (ostreesetup.ref, ))
        self._safeExecWithRedirect("ostree", admin_deploy_args)
        log.info("ostree admin deploy complete")
        progressQ.send_message(
            _("Deployment complete: %s") % (ostreesetup.ref, ))

        # Reload now that we've deployed, find the path to the new deployment
        sysroot.load(None)
        deployments = sysroot.get_deployments()
        assert len(deployments) > 0
        deployment = deployments[0]
        deployment_path = sysroot.get_deployment_directory(deployment)
        iutil.setSysroot(deployment_path.get_path())

        try:
            self._copyBootloaderData()
        except (OSError, RuntimeError) as e:
            exn = PayloadInstallError("Failed to copy bootloader data: %s" % e)
            log.error(str(exn))
            if errors.errorHandler.cb(exn) == errors.ERROR_RAISE:
                progressQ.send_quit(1)
                iutil.ipmi_report(constants.IPMI_ABORTED)
                sys.exit(1)

        mainctx.pop_thread_default()
コード例 #29
0
ファイル: __init__.py プロジェクト: jaymzh/anaconda
def tui_quit_callback(data):
    ipmi_report(IPMI_ABORTED)
コード例 #30
0
ファイル: __init__.py プロジェクト: xuhuilong/anaconda
def tui_quit_callback(data):
    ipmi_report(IPMI_ABORTED)
コード例 #31
0
ファイル: rpmostreepayload.py プロジェクト: rtruxal/anaconda
    def install(self):
        mainctx = GLib.MainContext.new()
        mainctx.push_thread_default()

        cancellable = None
        gi.require_version("OSTree", "1.0")
        from gi.repository import OSTree
        ostreesetup = self.data.ostreesetup
        log.info("executing ostreesetup=%r", ostreesetup)

        # Initialize the filesystem - this will create the repo as well
        self._safeExecWithRedirect("ostree",
            ["admin", "--sysroot=" + iutil.getTargetPhysicalRoot(),
             "init-fs", iutil.getTargetPhysicalRoot()])

        self._sysroot_path = Gio.File.new_for_path(iutil.getTargetPhysicalRoot())

        sysroot = OSTree.Sysroot.new(self._sysroot_path)
        sysroot.load(cancellable)
        repo = sysroot.get_repo(None)[1]
        # We don't support resuming from interrupted installs
        repo.set_disable_fsync(True)

        self._remoteOptions = {}

        if hasattr(ostreesetup, 'nogpg') and ostreesetup.nogpg:
            self._remoteOptions['gpg-verify'] = GLib.Variant('b', False)

        if flags.noverifyssl:
            self._remoteOptions['tls-permissive'] = GLib.Variant('b', True)

        repo.remote_change(None, OSTree.RepoRemoteChange.ADD_IF_NOT_EXISTS,
                           ostreesetup.remote, ostreesetup.url,
                           GLib.Variant('a{sv}', self._remoteOptions),
                           cancellable)

        progressQ.send_message(_("Starting pull of %(branchName)s from %(source)s") % \
                               {"branchName": ostreesetup.ref, "source": ostreesetup.remote})

        progress = OSTree.AsyncProgress.new()
        progress.connect('changed', self._pullProgressCb)

        try:
            repo.pull(ostreesetup.remote, [ostreesetup.ref], 0, progress, cancellable)
        except GLib.GError as e:
            exn = PayloadInstallError("Failed to pull from repository: %s" % e)
            log.error(str(exn))
            if errors.errorHandler.cb(exn) == errors.ERROR_RAISE:
                progressQ.send_quit(1)
                iutil.ipmi_report(constants.IPMI_ABORTED)
                sys.exit(1)

        progressQ.send_message(_("Preparing deployment of %s") % (ostreesetup.ref, ))

        # Now that we have the data pulled, delete the remote for now.
        # This will allow a remote configuration defined in the tree
        # (if any) to override what's in the kickstart.  Otherwise,
        # we'll re-add it in post.  Ideally, ostree would support a
        # pull without adding a remote, but that would get quite
        # complex.
        repo.remote_delete(self.data.ostreesetup.remote, None)

        self._safeExecWithRedirect("ostree",
            ["admin", "--sysroot=" + iutil.getTargetPhysicalRoot(),
             "os-init", ostreesetup.osname])

        admin_deploy_args = ["admin", "--sysroot=" + iutil.getTargetPhysicalRoot(),
                             "deploy", "--os=" + ostreesetup.osname]

        admin_deploy_args.append(ostreesetup.remote + ':' + ostreesetup.ref)

        log.info("ostree admin deploy starting")
        progressQ.send_message(_("Deployment starting: %s") % (ostreesetup.ref, ))
        self._safeExecWithRedirect("ostree", admin_deploy_args)
        log.info("ostree admin deploy complete")
        progressQ.send_message(_("Deployment complete: %s") % (ostreesetup.ref, ))

        # Reload now that we've deployed, find the path to the new deployment
        sysroot.load(None)
        deployments = sysroot.get_deployments()
        assert len(deployments) > 0
        deployment = deployments[0]
        deployment_path = sysroot.get_deployment_directory(deployment)
        iutil.setSysroot(deployment_path.get_path())

        try:
            self._copyBootloaderData()
        except (OSError, RuntimeError) as e:
            exn = PayloadInstallError("Failed to copy bootloader data: %s" % e)
            log.error(str(exn))
            if errors.errorHandler.cb(exn) == errors.ERROR_RAISE:
                progressQ.send_quit(1)
                iutil.ipmi_report(constants.IPMI_ABORTED)
                sys.exit(1)

        mainctx.pop_thread_default()
コード例 #32
0
            startup_utils.prompt_for_ssh()
            sys.exit(0)

    log.info("%s %s", sys.argv[0], startup_utils.get_anaconda_version_string())
    if os.path.exists("/tmp/updates"):
        log.info("Using updates in /tmp/updates/ from %s", opts.updateSrc)

    # TODO: uncomment this when we're sure that we're doing the right thing
    # with flags.cmdline *everywhere* it appears...
    #for arg in depr:
    #    stdout_log.warn("Boot argument '%s' is deprecated. "
    #                   "In the future, use 'inst.%s'.", arg, arg)

    from pyanaconda import isys

    iutil.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")
        iutil.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")
        iutil.ipmi_report(constants.IPMI_ABORTED)
        sys.exit(1)
    elif opts.dirinstall:
        root_path = opts.dirinstall
        iutil.setTargetPhysicalRoot(root_path)
        iutil.setSysroot(root_path)
コード例 #33
0
 def _earlyExceptionHandler(ty, value, traceback):
     iutil.ipmi_report(constants.IPMI_FAILED)
     iutil.vtActivate(1)
     return sys.__excepthook__(ty, value, traceback)
コード例 #34
0
ファイル: startup_utils.py プロジェクト: dougsland/anaconda
def check_memory(anaconda, options, display_mode=None):
    """Check is the system has enough RAM for installation.

    :param anaconda: instance of the Anaconda class
    :param options: command line/boot options
    :param display_mode: a display mode to use for the check
                         (graphical mode usually needs more RAM, etc.)
    """

    from pyanaconda import isys

    reason_strict = _("%(product_name)s requires %(needed_ram)s MB of memory to "
                      "install, but you only have %(total_ram)s MB on this machine.\n")
    reason_graphical = _("The %(product_name)s graphical installer requires %(needed_ram)s "
                         "MB of memory, but you only have %(total_ram)s MB\n.")

    reboot_extra = _('\n'
                     'Press [Enter] to reboot your system.\n')
    livecd_title = _("Not enough RAM")
    livecd_extra = _(" Try the text mode installer by running:\n\n"
                     "'/usr/bin/liveinst -T'\n\n from a root terminal.")
    nolivecd_extra = _(" Starting text mode.")

    # skip the memory check in rescue mode
    if options.rescue:
        return

    if not display_mode:
        display_mode = anaconda.display_mode

    reason = reason_strict
    total_ram = int(isys.total_memory() / 1024)
    needed_ram = int(isys.MIN_RAM)
    graphical_ram = int(isys.MIN_GUI_RAM)

    # count the squashfs.img in if it is kept in RAM
    if not iutil.persistent_root_image():
        needed_ram += isys.SQUASHFS_EXTRA_RAM
        graphical_ram += isys.SQUASHFS_EXTRA_RAM

    log.info("check_memory(): total:%s, needed:%s, graphical:%s",
             total_ram, needed_ram, graphical_ram)

    if not options.memcheck:
        log.warning("CHECK_MEMORY DISABLED")
        return

    reason_args = {"product_name": product.productName,
                   "needed_ram": needed_ram,
                   "total_ram": total_ram}
    if needed_ram > total_ram:
        if options.liveinst:
            # pylint: disable=logging-not-lazy
            stdout_log.warning(reason % reason_args)
            gtk_warning(livecd_title, reason % reason_args)
        else:
            reason += reboot_extra
            print(reason % reason_args)
            print(_("The installation cannot continue and the system will be rebooted"))
            print(_("Press ENTER to continue"))
            input()

        iutil.ipmi_report(constants.IPMI_ABORTED)
        sys.exit(1)

    # override display mode if machine cannot nicely run X
    if display_mode != constants.DisplayModes.TUI and not flags.usevnc:
        needed_ram = graphical_ram
        reason_args["needed_ram"] = graphical_ram
        reason = reason_graphical

        if needed_ram > total_ram:
            if options.liveinst:
                reason += livecd_extra
                # pylint: disable=logging-not-lazy
                stdout_log.warning(reason % reason_args)
                title = livecd_title
                gtk_warning(title, reason % reason_args)
                iutil.ipmi_report(constants.IPMI_ABORTED)
                sys.exit(1)
            else:
                reason += nolivecd_extra
                # pylint: disable=logging-not-lazy
                stdout_log.warning(reason % reason_args)
                anaconda.display_mode = constants.DisplayModes.TUI
                time.sleep(2)
コード例 #35
0
ファイル: tuiobject.py プロジェクト: jaymzh/anaconda
 def input(self, args, key):
     """Call IPMI ABORTED. Everything else will be done by original implementation."""
     iutil.ipmi_report(IPMI_ABORTED)
     super().input(args, key)
コード例 #36
0
 def input(self, args, key):
     """Call IPMI ABORTED. Everything else will be done by original implementation."""
     iutil.ipmi_report(IPMI_ABORTED)
     super().input(args, key)
コード例 #37
0
ファイル: anaconda.py プロジェクト: Jakuje/anaconda
    log.info("%s %s", sys.argv[0], getAnacondaVersionString())
    if os.path.exists("/tmp/updates"):
        log.info("Using updates in /tmp/updates/ from %s", opts.updateSrc)

    # TODO: uncomment this when we're sure that we're doing the right thing
    # with flags.cmdline *everywhere* it appears...
    #for arg in depr:
    #    stdoutLog.warn("Boot argument '%s' is deprecated. "
    #                   "In the future, use 'inst.%s'.", arg, arg)

    # pull this in to get product name and versioning
    from pyanaconda import product

    from pyanaconda import isys

    iutil.ipmi_report(constants.IPMI_STARTED)

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

    if opts.images and opts.dirinstall:
        stdoutLog.error("--images and --dirinstall cannot be used at the same time")
        iutil.ipmi_report(constants.IPMI_ABORTED)
        sys.exit(1)
    elif opts.dirinstall:
        root_path = opts.dirinstall
        iutil.setTargetPhysicalRoot(root_path)
        iutil.setSysroot(root_path)
コード例 #38
0
ファイル: startup_utils.py プロジェクト: mariannecx/anaconda
def check_memory(anaconda, options, display_mode=None):
    """Check is the system has enough RAM for installation.

    :param anaconda: instance of the Anaconda class
    :param options: command line/boot options
    :param display_mode: a display mode to use for the check
                         (graphical mode usually needs more RAM, etc.)
    """

    from pyanaconda import isys

    reason_strict = _(
        "%(product_name)s requires %(needed_ram)s MB of memory to "
        "install, but you only have %(total_ram)s MB on this machine.\n")
    reason_graphical = _(
        "The %(product_name)s graphical installer requires %(needed_ram)s "
        "MB of memory, but you only have %(total_ram)s MB\n.")

    reboot_extra = _('\n' 'Press [Enter] to reboot your system.\n')
    livecd_title = _("Not enough RAM")
    livecd_extra = _(" Try the text mode installer by running:\n\n"
                     "'/usr/bin/liveinst -T'\n\n from a root terminal.")
    nolivecd_extra = _(" Starting text mode.")

    # skip the memory check in rescue mode
    if options.rescue:
        return

    if not display_mode:
        display_mode = anaconda.display_mode

    reason = reason_strict
    total_ram = int(isys.total_memory() / 1024)
    needed_ram = int(isys.MIN_RAM)
    graphical_ram = int(isys.MIN_GUI_RAM)

    # count the squashfs.img in if it is kept in RAM
    if not iutil.persistent_root_image():
        needed_ram += isys.SQUASHFS_EXTRA_RAM
        graphical_ram += isys.SQUASHFS_EXTRA_RAM

    log.info("check_memory(): total:%s, needed:%s, graphical:%s", total_ram,
             needed_ram, graphical_ram)

    if not options.memcheck:
        log.warning("CHECK_MEMORY DISABLED")
        return

    reason_args = {
        "product_name": product.productName,
        "needed_ram": needed_ram,
        "total_ram": total_ram
    }
    if needed_ram > total_ram:
        if options.liveinst:
            # pylint: disable=logging-not-lazy
            stdout_log.warning(reason % reason_args)
            gtk_warning(livecd_title, reason % reason_args)
        else:
            reason += reboot_extra
            print(reason % reason_args)
            print(
                _("The installation cannot continue and the system will be rebooted"
                  ))
            print(_("Press ENTER to continue"))
            input()

        iutil.ipmi_report(constants.IPMI_ABORTED)
        sys.exit(1)

    # override display mode if machine cannot nicely run X
    if display_mode != constants.DisplayModes.TUI and not flags.usevnc:
        needed_ram = graphical_ram
        reason_args["needed_ram"] = graphical_ram
        reason = reason_graphical

        if needed_ram > total_ram:
            if options.liveinst:
                reason += livecd_extra
                # pylint: disable=logging-not-lazy
                stdout_log.warning(reason % reason_args)
                title = livecd_title
                gtk_warning(title, reason % reason_args)
                iutil.ipmi_report(constants.IPMI_ABORTED)
                sys.exit(1)
            else:
                reason += nolivecd_extra
                # pylint: disable=logging-not-lazy
                stdout_log.warning(reason % reason_args)
                anaconda.display_mode = constants.DisplayModes.TUI
                time.sleep(2)
コード例 #39
0
ファイル: anaconda.py プロジェクト: Jakuje/anaconda
 def _earlyExceptionHandler(ty, value, traceback):
     iutil.ipmi_report(constants.IPMI_FAILED)
     iutil.vtActivate(1)
     return sys.__excepthook__(ty, value, traceback)
コード例 #40
0
    def startServer(self):
        self.log.info(_("Starting VNC..."))
        network.wait_for_connectivity()

        # Lets call it from here for now.
        try:
            self.initialize()
        except (socket.herror, dbus.DBusException, ValueError) as e:
            stdoutLog.critical("Could not initialize the VNC server: %s", e)
            iutil.ipmi_report(constants.IPMI_ABORTED)
            sys.exit(1)

        if self.password and (len(self.password) < 6 or len(self.password) > 8):
            self.changeVNCPasswdWindow()

        if not self.password:
            SecurityTypes = "None"
            rfbauth = "0"
        else:
            SecurityTypes = "VncAuth"
            rfbauth = self.pw_file
            # Create the password file.
            self.setVNCPassword()

        # Lets start the xvnc.
        xvnccommand = [XVNC_BINARY_NAME, ":%s" % constants.X_DISPLAY_NUMBER,
                       "-depth", "16", "-br",
                       "IdleTimeout=0", "-auth", "/dev/null", "-once",
                       "DisconnectClients=false", "desktop=%s" % (self.desktop,),
                       "SecurityTypes=%s" % SecurityTypes, "rfbauth=%s" % rfbauth]

        try:
            iutil.startX(xvnccommand, output_redirect=self.openlogfile())
        except OSError:
            stdoutLog.critical("Could not start the VNC server.  Aborting.")
            iutil.ipmi_report(constants.IPMI_ABORTED)
            sys.exit(1)

        self.log.info(_("The VNC server is now running."))

        # Lets tell the user what we are going to do.
        if self.vncconnecthost != "":
            self.log.warning(_("\n\nYou chose to connect to a listening vncviewer. \n"
                                "This does not require a password to be set.  If you \n"
                                "set a password, it will be used in case the connection \n"
                                "to the vncviewer is unsuccessful\n\n"))
        elif self.password == "":
            self.log.warning(_("\n\nWARNING!!! VNC server running with NO PASSWORD!\n"
                                "You can use the vncpassword=<password> boot option\n"
                                "if you would like to secure the server.\n\n"))
        elif self.password != "":
            self.log.warning(_("\n\nYou chose to execute vnc with a password. \n\n"))
        else:
            self.log.warning(_("\n\nUnknown Error.  Aborting. \n\n"))
            iutil.ipmi_report(constants.IPMI_ABORTED)
            sys.exit(1)

        # Lets try to configure the vnc server to whatever the user specified
        if self.vncconnecthost != "":
            connected = self.connectToView()
            if not connected:
                self.VNCListen()
        else:
            self.VNCListen()

        # Start vncconfig for copy/paste
        self.startVncConfig()