Skip to content

Commit

Permalink
Check if text mode was actually requested by kickstart (#2293672)
Browse files Browse the repository at this point in the history
Provide information about text mode being requested via DBus property
set at kickstart parsing time & check this property when deciding if
the VNC question should be shown.

Also cleanup the code a bit and fix a typo affecting vnc command parsing.

Resolves: rhbz#2293672
  • Loading branch information
M4rtinK committed Aug 12, 2024
1 parent ea262d4 commit a21ceb4
Show file tree
Hide file tree
Showing 3 changed files with 43 additions and 9 deletions.
23 changes: 14 additions & 9 deletions pyanaconda/display.py
Original file line number Diff line number Diff line change
Expand Up @@ -155,15 +155,20 @@ def check_vnc_can_be_started(anaconda):
(blivet.util.total_memory(), min_gui_ram))
vnc_startup_possible = False

# disable VNC question if text mode is requested and this is a ks install
if anaconda.tui_mode and flags.automatedInstall:
error_messages.append("Not asking for VNC because of an automated install")
vnc_startup_possible = False

# disable VNC question if we were explicitly asked for text in kickstart
if anaconda.display_mode == constants.DisplayModes.TUI:
error_messages.append("Not asking for VNC because text mode was explicitly asked for in kickstart")
vnc_startup_possible = False
# if running in text mode, we might sometimes skip showing the VNC question
if anaconda.tui_mode:
# disable VNC question if we were explicitly asked for text mode in kickstart
ui_proxy = RUNTIME.get_proxy(USER_INTERFACE)
if ui_proxy.DisplayModeTextKickstarted:
error_messages.append(
"Not asking for VNC because text mode was explicitly asked for in kickstart"
)
vnc_startup_possible = False
# disable VNC question if text mode is requested and this is an automated kickstart
# installation
elif flags.automatedInstall:
error_messages.append("Not asking for VNC because of an automated install")
vnc_startup_possible = False

# disable VNC question if we don't have network
network_proxy = NETWORK.get_proxy()
Expand Down
24 changes: 24 additions & 0 deletions pyanaconda/modules/runtime/user_interface/ui.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@
from pyanaconda.modules.common.constants.objects import USER_INTERFACE
from pyanaconda.modules.common.structures.policy import PasswordPolicy

from pykickstart.commands.displaymode import DISPLAY_MODE_TEXT

log = get_module_logger(__name__)

__all__ = ["UIModule"]
Expand All @@ -48,6 +50,9 @@ def __init__(self):
self.display_mode_nonInteractive_changed = Signal()
self._displayMode_nonInteractive = False

self.display_mode_text_kickstarted_changed = Signal()
self._display_mode_text_kickstarted = False

self.vnc_changed = Signal()
self._vnc = VncData()

Expand All @@ -59,6 +64,12 @@ def process_kickstart(self, data):
"""Process the kickstart data."""
self.set_display_mode(data.displaymode.displayMode)
self.set_display_mode_non_interactive(data.displaymode.nonInteractive)
# check if text mode was requested in kickstart
if data.displaymode.displayMode == DISPLAY_MODE_TEXT:
log.debug("Text mode requested by kickstart")
self._display_mode_text_kickstarted = True
self.display_mode_text_kickstarted_changed.emit()

vnc = VncData()
vnc.enabled = data.vnc.enabled
vnc.host = data.vnc.host
Expand Down Expand Up @@ -113,6 +124,19 @@ def set_display_mode_non_interactive(self, non_interactive):
self.display_mode_nonInteractive_changed.emit()
log.debug("Display mode non-interactive set to: %s", str(non_interactive))

@property
def display_mode_text_kickstarted(self):
"""Report if text mode was explicitely requested via kickstart.
#NOTE: No setter as this is only set once when parsing the kickstasrt.
:return: if text mode was requested by kickstart
:rtype: bool
"""

return self._display_mode_text_kickstarted

@property
def vnc(self):
"""The VncData.
Expand Down
5 changes: 5 additions & 0 deletions pyanaconda/modules/runtime/user_interface/ui_interface.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,11 @@ def DisplayModeNonInteractive(self, non_interactive: Bool):
"""
self.implementation.set_display_mode_non_interactive(non_interactive)

@property
def DisplayModeTextKickstarted(self) -> Bool:
"""Report if text mode was explicitly requested via kickstart."""
return self.implementation.display_mode_text_kickstarted

@property
def Vnc(self) -> Structure:
"""Specification of the vnc configuration."""
Expand Down

0 comments on commit a21ceb4

Please sign in to comment.