Skip to content

Commit

Permalink
Make possible to start TUI with installed WebUI
Browse files Browse the repository at this point in the history
  • Loading branch information
adamkankovsky committed Nov 13, 2023
1 parent a70ac7c commit 98f20f8
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 13 deletions.
11 changes: 1 addition & 10 deletions pyanaconda/anaconda.py
Original file line number Diff line number Diff line change
Expand Up @@ -147,15 +147,6 @@ def tui_mode(self):
"""Report if Anaconda should run with the TUI."""
return self._display_mode == DisplayModes.TUI

@property
def webui_mode(self):
"""Report if Anaconda should run with WebUI."""
# this boot option is meant to be temporary, so just check it directly
# from kernel boot command line like this
return self.display_mode == DisplayModes.WEBUI \
or "webui" in kernel_arguments \
or os.path.exists("/usr/share/cockpit/anaconda-webui")

def log_display_mode(self):
if not self.display_mode:
log.error("Display mode is not set!")
Expand Down Expand Up @@ -209,7 +200,7 @@ def initInterface(self):
if self._intf:
raise RuntimeError("Second attempt to initialize the InstallInterface")

if self.webui_mode:
if self.gui_mode and os.path.exists("/usr/share/cockpit/anaconda-webui"):
from pyanaconda.ui.webui import CockpitUserInterface
self._intf = CockpitUserInterface(
None,
Expand Down
2 changes: 0 additions & 2 deletions pyanaconda/core/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -303,13 +303,11 @@ class SecretStatus(Enum):
class DisplayModes(Enum):
GUI = "GUI"
TUI = "TUI"
WEBUI = "WEBUI"


DISPLAY_MODE_NAME = {
DisplayModes.GUI: "graphical mode",
DisplayModes.TUI: "text mode",
DisplayModes.WEBUI: "webui mode"
}

INTERACTIVE_MODE_NAME = {
Expand Down
3 changes: 2 additions & 1 deletion pyanaconda/display.py
Original file line number Diff line number Diff line change
Expand Up @@ -302,7 +302,8 @@ def setup_display(anaconda, options):
if vnc_server.vncconnectport == "":
vnc_server.vncconnectport = anaconda.ksdata.vnc.port

if anaconda.gui_mode:
# check if GUI without WebUI
if anaconda.gui_mode and not os.path.exists("/usr/share/cockpit/anaconda-webui"):
mods = (tup[1] for tup in pkgutil.iter_modules(pyanaconda.ui.__path__, "pyanaconda.ui."))
if "pyanaconda.ui.gui" not in mods:
stdout_log.warning("Graphical user interface not available, falling back to text mode")
Expand Down

0 comments on commit 98f20f8

Please sign in to comment.