forked from ClusterLabs/crmsh
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix: report: find_shell should accept hacluster user (bsc#1228899) (C…
…lusterLabs#1564) 1. Fix `crm.report.sh.Shell.subprocess_run_without_input`. It is expected to run commands as a specified user on a specified host. The user and host is carried in `Shell` instance, so that callers do not need to specify one when calling method `subprocess_run_without_input`. 2. Modify `crm.report.sh.Shell. _try_create_report_shell` to make it work for 2 different senerios: 1. When the specified user is `root` or `hacluster`, returns a `crmsh.sh.SSHShell` wrapped in an adaptor `crm.report.sh.SSHShell`, so that commands runs directly as the specified user. 2. When the specified user is not `root` or `hacluster`, try to run `sudo` with the `SSHShell`. If 1. sudo works, returns a `crmsh.report.sh.SSHSudoShell`, which prepends a `sudo` to the command and runs it with `crmsh.SSHShell`. 2. sudo does not work, return None, failing to create a usable instance of `crm.report.sh.ShellShell`.
- Loading branch information
Showing
3 changed files
with
58 additions
and
35 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters