diff --git a/crmsh/scripts.py b/crmsh/scripts.py index c90f86ec4..ecae1c046 100644 --- a/crmsh/scripts.py +++ b/crmsh/scripts.py @@ -1638,6 +1638,13 @@ def _copy_utils(dst): raise ValueError(e) +def _check_parallax_remote_available(printer, hosts): + try: + _parallax_call(printer, hosts, 'true', timeout_seconds=15) + except utils.UserOfHost.UserNotFoundError: + raise ValueError('Passwordless ssh does not work.') from None + + def _create_remote_workdirs(printer, hosts, path, timeout_seconds): "Create workdirs on remote hosts" ok = True @@ -1778,6 +1785,7 @@ def prepare(self, has_remote_actions): json.dump(self.data, open(self.statefile, 'w')) _copy_utils(self.workdir) if has_remote_actions: + _check_parallax_remote_available(self.printer, self.hosts) _create_remote_workdirs(self.printer, self.hosts, self.workdir, self.timeout_seconds) _copy_to_remote_dirs(self.printer, self.hosts, self.workdir, self.timeout_seconds) # make sure all path references are relative to the script directory @@ -2105,7 +2113,10 @@ def run(script, params, printer): finally: if not dry_run: if not config.core.debug: - _run_cleanup(printer, has_remote_actions, local_node, hosts, workdir, int(params['timeout'])) + try: + _run_cleanup(printer, has_remote_actions, local_node, hosts, workdir, int(params['timeout'])) + except utils.UserOfHost.UserNotFoundError: + pass elif has_remote_actions: _print_debug(printer, local_node, hosts, workdir, int(params['timeout'])) else: diff --git a/crmsh/utils.py b/crmsh/utils.py index b8067c0c4..69cf213f4 100644 --- a/crmsh/utils.py +++ b/crmsh/utils.py @@ -153,7 +153,7 @@ def user_pair_for_ssh(self, host: str) -> typing.Tuple[str, str]: else: ret = self._guess_user_for_ssh(host) if ret is None: - raise self.UserNotFoundError + raise self.UserNotFoundError from None else: self._user_pair_cache[host] = ret return ret