Skip to content

Commit

Permalink
Merge pull request #5295 from adamkankovsky/webui-possible-start-tui
Browse files Browse the repository at this point in the history
Make possible to start TUI with installed WebUI
  • Loading branch information
KKoukiou committed Nov 21, 2023
2 parents a0bf721 + 60f5718 commit f4fa15c
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 11 deletions.
12 changes: 4 additions & 8 deletions pyanaconda/anaconda.py
Original file line number Diff line number Diff line change
Expand Up @@ -148,13 +148,9 @@ def tui_mode(self):
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 is_webui_supported(self):
"Report if webui package is installed"
return os.path.exists("/usr/share/cockpit/anaconda-webui")

def log_display_mode(self):
if not self.display_mode:
Expand Down Expand Up @@ -209,7 +205,7 @@ def initInterface(self):
if self._intf:
raise RuntimeError("Second attempt to initialize the InstallInterface")

if self.webui_mode:
if self.gui_mode and self.is_webui_supported:
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 anaconda.is_webui_supported:
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 f4fa15c

Please sign in to comment.