Skip to content

Commit

Permalink
Merge pull request #6037 from jkonecny12/rhel-10-rdp-credentials-fetc…
Browse files Browse the repository at this point in the history
…hing

RHEL-10: Do not crash if RDP is selected after regular GUI startup failed
  • Loading branch information
KKoukiou authored Jan 14, 2025
2 parents b9ce5a5 + 19863cb commit 30971cf
Showing 1 changed file with 19 additions and 15 deletions.
34 changes: 19 additions & 15 deletions pyanaconda/display.py
Original file line number Diff line number Diff line change
Expand Up @@ -117,12 +117,6 @@ def ask_rd_question(anaconda, message):
ScreenHandler.schedule_screen(spoke)
App.run()

if spoke.use_remote_desktop:
if not anaconda.gui_mode:
log.info("RDP requested via RDP question, switching Anaconda to GUI mode.")
anaconda.display_mode = constants.DisplayModes.GUI
flags.use_rd = True

return (spoke.use_remote_desktop, rdp_credentials(spoke.rdp_username, spoke.rdp_password))


Expand All @@ -133,7 +127,8 @@ def ask_for_rd_credentials(anaconda, username=None, password=None):
:param str username: user set username (if any)
:param str password: user set password (if any)
:return: namedtuple rdp_credentials(username, password)
:return: (use_rd, rdp_credentials(username, password))
:rtype: Tuple(bool, NameTuple(username, password))
"""
App.initialize()
loop = App.get_event_loop()
Expand All @@ -142,10 +137,7 @@ def ask_for_rd_credentials(anaconda, username=None, password=None):
ScreenHandler.schedule_screen(spoke)
App.run()

log.info("RDP credentials set")
anaconda.display_mode = constants.DisplayModes.GUI
flags.use_rd = True
return rdp_credentials(spoke._username, spoke._password)
return (True, rdp_credentials(spoke._username, spoke._password))

def check_rd_can_be_started(anaconda):
"""Check if we can start an RDP session in the current environment.
Expand Down Expand Up @@ -338,9 +330,10 @@ def setup_display(anaconda, options):
# or inst.rdp and insufficient credentials are provided
# via boot options, ask interactively.
if options.rdp_enabled and not rdp_credentials_sufficient:
rdp_creds = ask_for_rd_credentials(anaconda,
options.rdp_username,
options.rdp_password)
use_rd, rdp_creds = ask_for_rd_credentials(anaconda,
options.rdp_username,
options.rdp_password)
_set_gui_mode_on_rdp(anaconda, use_rd)
else:
# RDP can't be started - disable the RDP question and log
# all the errors that prevented RDP from being started
Expand All @@ -355,6 +348,7 @@ def setup_display(anaconda, options):
"full control over the disk layout. Would you like "
"to use remote graphical access via the RDP protocol instead?")
use_rd, credentials = ask_rd_question(anaconda, message)
_set_gui_mode_on_rdp(anaconda, use_rd)
if not use_rd:
# user has explicitly specified text mode
flags.rd_question = False
Expand Down Expand Up @@ -405,7 +399,10 @@ def on_mutter_ready(observer):
"an RDP session to connect to this computer from another computer and "
"perform a graphical installation or continue with a text mode "
"installation?")
rdp_creds = ask_rd_question(anaconda, message)
# we aren't really interested in the use_rd flag so at least mark it like this
# to avoid linters being grumpy
use_rd, rdp_creds = ask_rd_question(anaconda, message)
_set_gui_mode_on_rdp(anaconda, use_rd)

# if they want us to use RDP do that now
if anaconda.gui_mode and flags.use_rd:
Expand All @@ -423,3 +420,10 @@ def on_mutter_ready(observer):
# as we might now be in text mode, which might not be able to display
# the characters from our current locale
startup_utils.reinitialize_locale(text_mode=anaconda.tui_mode)


def _set_gui_mode_on_rdp(anaconda, use_rdp):
if not anaconda.gui_mode:
log.info("RDP requested via RDP question, switching Anaconda to GUI mode.")
anaconda.display_mode = constants.DisplayModes.GUI
flags.use_rd = use_rdp

0 comments on commit 30971cf

Please sign in to comment.