Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make possible to start TUI with installed WebUI #5295

Merged
merged 1 commit into from
Nov 21, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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:
poncovka marked this conversation as resolved.
Show resolved Hide resolved
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