diff --git a/crmsh/report/utillib.py b/crmsh/report/utillib.py index 2c817bad18..235a46d940 100644 --- a/crmsh/report/utillib.py +++ b/crmsh/report/utillib.py @@ -1373,7 +1373,7 @@ def start_slave_collector(node, arg_str): logger.warning(err) break if err: - print(err) + print(err, file=sys.stderr) if out == '': # if we couldn't get anything return diff --git a/crmsh/utils.py b/crmsh/utils.py index 978eeac4e3..d48acf10b6 100644 --- a/crmsh/utils.py +++ b/crmsh/utils.py @@ -184,7 +184,10 @@ def _get_user_of_host_from_config(host): def _guess_user_for_ssh(host: str) -> typing.Tuple[str, str]: args = ['ssh'] args.extend(constants.SSH_OPTION_ARGS) - args.extend(['-o', 'BatchMode=yes', host, 'sudo', 'true']) + if userdir.get_sudoer(): + args.extend(['-o', 'BatchMode=yes', host, 'sudo', 'true']) + else: + args.extend(['-o', 'BatchMode=yes', host, 'true']) rc = subprocess.call( args, stdin=subprocess.DEVNULL, diff --git a/test/features/cluster_api.feature b/test/features/cluster_api.feature index cea6350404..61140699b5 100644 --- a/test/features/cluster_api.feature +++ b/test/features/cluster_api.feature @@ -18,11 +18,11 @@ Feature: Functional test to cover SAP clusterAPI And Wait "3" seconds Then Resource "d" type "Dummy" is "Started" And Show cluster status on "hanode1" + When Run "echo 'export PATH=$PATH:/usr/sbin/' > ~hacluster/.bashrc" on "hanode1" + When Run "echo 'export PATH=$PATH:/usr/sbin/' > ~hacluster/.bashrc" on "hanode2" @clean Scenario: Start and stop resource by hacluster - When Run "echo 'export PATH=$PATH:/usr/sbin/' >> ~hacluster/.bashrc" on "hanode1" - When Run "echo 'export PATH=$PATH:/usr/sbin/' >> ~hacluster/.bashrc" on "hanode2" When Run "su - hacluster -c 'crm resource stop d'" on "hanode1" Then Expected return code is "0" When Wait "3" seconds