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

Only ask for sudo password when required #484

Merged
merged 4 commits into from
Apr 10, 2024

Conversation

epheo
Copy link
Contributor

@epheo epheo commented Feb 15, 2024

This resolves #483

Check nmcli permissions and only ask for password if required.

Move getpass to separate func and validate password input, Otherwise raise RuntimeError

Change sudo func to return an empty string if no sudo password is provided in order to prevent formatting of the nmcli commands with sudo prefix if not required.
Raise condition is moved at password input using assert.

epheo and others added 3 commits February 15, 2024 01:56
Check nmcli permissions and only ask for password if required.

Move getpass to separate func and validate password input using assert
Otherwise raise AssertionError

Change sudo func to return an empty string if no sudo password is
provided in order to prevent formating of the nmcli commands with sudo
prefix if not required.
Raise condition is moved at password input.
As password isn't a mandatory requirement for the follwing classes
also accept None type arg for password.
- Nmcli0990Wireless
- NmcliWireless
- WpasupplicantWireless

Replace assert with if not raise RunTime error.
@tcamise-gpsw tcamise-gpsw self-assigned this Apr 10, 2024
@tcamise-gpsw tcamise-gpsw merged commit 1b4b451 into gopro:main Apr 10, 2024
11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

only ask for sudo password when required
2 participants