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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

M4rtinK
Copy link
Contributor

@M4rtinK M4rtinK commented Nov 15, 2024

The ask_rd_question() function returns not only the credentials tuple, but also the "use remote desktop" flag.

We correctly handled that in the regular case where we ask for user password if user selected RDP instead of text mode.

But we missed that in the harder to test case where RDP is suggested as an option to the user after regular locally running GUI startup fails. Oops! :P

So handle the extra value and avoid the crash. :)

Resolves: rhbz#2326410

…26410)

The ask_rd_question() function returns not only the credentials tuple,
but also the "use remote desktop" flag.

We correctly handled that in the regular case where we ask for user
password if user selected RDP instead of text mode.

But we missed that in the harder to test case where RDP is suggested
as an option to the user after regular locally running GUI startup
fails. Oops! :P

So handle the extra value and avoid the crash. :)

Resolves: rhbz#2326410
@M4rtinK
Copy link
Contributor Author

M4rtinK commented Nov 15, 2024

/kickstart-test --testtype smoke

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)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Honestly to me this doesn't seem correct.

I don't think we should set the flag.use_rd, it looks to me like a side effect. Another option is to not return the value but that would be less preferable to me as the side effect is still there.

In other words, from looking on this change set it doesn't sense why we ignore this value when we ask for it on line below, however, it's not visible that the use_rd flag is set inside the ask_rd_question.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would rather rewrite the calls in this method to something like:

def set_gui_mode_on_rdp(anaconda, use_rd):
        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

use_rd, rdp_creds = ask_rd_question(message)
set_gui_mode_on_rdp(anaconda, use_rd)

Seems cleaner to me.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

Successfully merging this pull request may close these issues.

2 participants