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

Do not crash if RDP is selected after regular GUI startup failed (#2326410) #5999

Merged
Merged
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
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):
Expand Down Expand Up @@ -339,9 +331,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 @@ -356,6 +349,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 @@ -406,7 +400,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 @@ -424,3 +421,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