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

Add try_sudo to Pulp Smash CLI client #1037

Closed
Ichimonji10 opened this issue May 25, 2018 · 1 comment
Closed

Add try_sudo to Pulp Smash CLI client #1037

Ichimonji10 opened this issue May 25, 2018 · 1 comment
Assignees

Comments

@Ichimonji10
Copy link
Contributor

If one wants to run a command as root, the current idiom for doing so is this:

sudo = () if is_root(...) else ('sudo',)
cli_client.run(sudo + ('my', 'cli', 'command'))

It'd be far more convenient if the CLI client could encapsulate this idiom. One possible route would be to:

  1. Fix Move is_root #1036
  2. Update the CLI client so that it could be used like cli_client.run(('my', 'cli', 'command'), maybe_sudo=True).

If maybe_sudo is passed, then the sudo = ...; cmd = sudo + cmd idiom could be performed within the CLI client. This idiom won't work in all cases. Sometimes, sudo shouldn't be the first word in a command. For these cases, a user should still be able to use is_root, so we should make the maybe_sudo argument default to false and leave the is_root function in place.

@rochacbruno
Copy link
Member

Addressed by #1132

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

No branches or pull requests

2 participants