Example #1
0
    def run(self):
        self.__load_plugins()

        if not self.__plugins:
            raise Exception("No plugins found in '%s'" % self.plugin_base)
        self.ui.register_hotkey("f2", self.__drop_to_shell)
        self.ui.register_hotkey("f12", self.__reload_page)
        self.ui.register_hotkey("window resize", self.__check_terminal_size)

        self.ui.header = "\n %s\n" % str(self.product)
        self.ui.footer = "Press esc to quit."

        try:
            if system.is_rescue_mode():
                self.logger.error("The TUI cannot be used in rescue mode. "
                                  "Please reboot without rescue to "
                                  "configure/install.")
                sys.exit(0)
            self.ui.run()
        except Exception as e:
            console.reset()
            self.logger.error("An error appeared in the UI: %s" % repr(e))
            self.logger.debug("Exception:", exc_info=True)
            if self.args.debug:
                raise
            console.writeln("Press ENTER to logout ...")
            console.writeln("or enter 's' to drop to shell")
            if console.wait_for_keypress() == 's':
                self.__drop_to_shell()
    def run(self):
        self.__load_plugins()

        if not self.__plugins:
            raise Exception("No plugins found in '%s'" % self.plugin_base)
        self.ui.register_hotkey("f2", self.__drop_to_shell)
        self.ui.register_hotkey("f12", self.__reload_page)
        self.ui.register_hotkey("window resize", self.__check_terminal_size)

        self.ui.header = "\n %s\n" % str(self.product)
        self.ui.footer = "Press esc to quit."

        try:
            if system.is_rescue_mode():
                self.logger.error("The TUI cannot be used in rescue mode. "
                                  "Please reboot without rescue to "
                                  "configure/install.")
                import sys
                sys.exit(0)
            self.ui.run()
        except Exception as e:
            console.reset()
            self.logger.error("An error appeared in the UI: %s" % repr(e))
            self.logger.info("Exception:", exc_info=True)
            console.writeln("Press ENTER to logout ...")
            console.writeln("or enter 's' to drop to shell")
            if console.wait_for_keypress() == 's':
                self.__drop_to_shell()
Example #3
0
    def run(self):
        self.__load_plugins()

        if not self.__plugins:
            raise Exception("No plugins found in '%s'" % self.plugin_base)
        self.ui.register_hotkey("f2", self.__drop_to_shell)
        self.ui.register_hotkey("f12", self.__reload_page)
        self.ui.register_hotkey("window resize", self.__check_terminal_size)

        if os.path.exists("/etc/ovirt-node/node-comment"):
            with open("/etc/ovirt-node/node-comment") as f:
                self.ui.header = "\n%s %s\n" % (f.read(), str(self.product))
        else:
            self.ui.header = "\n %s\n" % str(self.product)

        self.ui.footer = "Press esc to quit."

        # Catch ctrl+c
        if not self.args.debug:

            def _handler(signum, frame):
                self.logger.debug("CTRL+C pressed")

            sys_signal.signal(sys_signal.SIGINT, _handler)

        if system.is_rescue_mode():
            self.logger.error("The TUI cannot be used in rescue mode. "
                              "Please reboot without rescue to "
                              "configure/install.")
            sys.exit(0)

        try:
            self.ui.run()
        except Exception as e:
            console.reset()
            self.logger.error("An error appeared in the UI: %s" % repr(e))
            self.logger.info("Exception:", exc_info=True)
            console.writeln("Press ENTER to logout ...")
            console.writeln("or enter 's' to drop to shell")
            if console.wait_for_keypress() == 's':
                self.__drop_to_shell()
Example #4
0
    def run(self):
        self.__load_plugins()

        if not self.__plugins:
            raise Exception("No plugins found in '%s'" % self.plugin_base)
        self.ui.register_hotkey("f2", self.__drop_to_shell)
        self.ui.register_hotkey("f12", self.__reload_page)
        self.ui.register_hotkey("window resize", self.__check_terminal_size)

        if os.path.exists("/etc/ovirt-node/node-comment"):
            with open("/etc/ovirt-node/node-comment") as f:
                self.ui.header = "\n%s %s\n" % (f.read(), str(self.product))
        else:
            self.ui.header = "\n %s\n" % str(self.product)

        self.ui.footer = "Press esc to quit."

        # Catch ctrl+c
        if not self.args.debug:
            def _handler(signum, frame):
                self.logger.debug("CTRL+C pressed")
            sys_signal.signal(sys_signal.SIGINT, _handler)

        if system.is_rescue_mode():
            self.logger.error("The TUI cannot be used in rescue mode. "
                              "Please reboot without rescue to "
                              "configure/install.")
            sys.exit(0)

        try:
            self.ui.run()
        except Exception as e:
            console.reset()
            self.logger.error("An error appeared in the UI: %s" % repr(e))
            self.logger.info("Exception:", exc_info=True)
            console.writeln("Press ENTER to logout ...")
            console.writeln("or enter 's' to drop to shell")
            if console.wait_for_keypress() == 's':
                self.__drop_to_shell()