diff --git a/crmsh/report/collect.py b/crmsh/report/collect.py index 5641f681dd..7476be0928 100644 --- a/crmsh/report/collect.py +++ b/crmsh/report/collect.py @@ -10,6 +10,7 @@ import pwd import datetime +import crmsh.user_of_host from crmsh import log, sh from crmsh import utils as crmutils from crmsh.report import constants, utillib @@ -56,7 +57,14 @@ def collect_ratraces(): """ # since the "trace_dir" attribute been removed from cib after untrace # need to parse crmsh log file to extract custom trace ra log directory on each node - shell = sh.cluster_shell() + if crmsh.user_of_host.instance().use_ssh_agent(): + shell = sh.ClusterShell( + sh.LocalShell(additional_environ={'SSH_AUTH_SOCK': os.environ.get('SSH_AUTH_SOCK', '')}), + crmsh.user_of_host.instance(), + forward_ssh_agent=True, + ) + else: + shell = sh.cluster_shell() log_contents = "" cmd = "grep 'INFO: Trace for .* is written to ' {}*|grep -v 'collect'".format(log.CRMSH_LOG_FILE) for node in crmutils.list_cluster_nodes(): diff --git a/crmsh/report/utillib.py b/crmsh/report/utillib.py index 7f5e135ffd..261899de48 100644 --- a/crmsh/report/utillib.py +++ b/crmsh/report/utillib.py @@ -417,7 +417,7 @@ def get_distro_info(): res = re.search("PRETTY_NAME=\"(.*)\"", read_from_file(constants.OSRELEASE)) elif which("lsb_release"): logger.debug("Using lsb_release to get distribution info") - out = sh.cluster_shell().get_stdout_or_raise_error("lsb_release -d") + out = sh.LocalShell().get_stdout_or_raise_error("lsb_release -d") res = re.search("Description:\s+(.*)", out) return res.group(1) if res else "Unknown" diff --git a/test/features/ssh_agent.feature b/test/features/ssh_agent.feature index be6e87f0ff..7d62f20852 100644 --- a/test/features/ssh_agent.feature +++ b/test/features/ssh_agent.feature @@ -79,3 +79,6 @@ Feature: ssh-agent support Then Show cluster status on "hanode1" When Run "crm resource start g-booth" on "hanode2" Then Show cluster status on "hanode2" + + Scenario: crm report + Then Run "crm report"