mirror of
https://github.com/ceph/ceph
synced 2025-02-23 02:57:21 +00:00
mgr/orch: re-raise to make debugging easier
Signed-off-by: Sebastian Wagner <sewagner@redhat.com>
This commit is contained in:
parent
d0c17ee1c4
commit
38b52f715f
@ -1386,10 +1386,10 @@ class TestCephadm(object):
|
||||
_get_daemon_types.return_value = ['crash']
|
||||
_hosts.return_value = [hostname, 'other_host']
|
||||
cephadm_module.inventory.add_host(HostSpec(hostname))
|
||||
# should raise an error which will get stored in OrchResult object
|
||||
retval = cephadm_module.enter_host_maintenance(hostname)
|
||||
assert retval.exception_str
|
||||
assert not retval.result_str()
|
||||
|
||||
with pytest.raises(OrchestratorError, match='Failed to place host1 into maintenance for cluster fsid'):
|
||||
cephadm_module.enter_host_maintenance(hostname)
|
||||
|
||||
assert not cephadm_module.inventory._inventory[hostname]['status']
|
||||
|
||||
@mock.patch("cephadm.serve.CephadmServe._run_cephadm")
|
||||
@ -1418,10 +1418,10 @@ class TestCephadm(object):
|
||||
_get_daemon_types.return_value = ['crash']
|
||||
_hosts.return_value = [hostname, 'other_host']
|
||||
cephadm_module.inventory.add_host(HostSpec(hostname, status='maintenance'))
|
||||
# should raise an error which will get stored in OrchResult object
|
||||
retval = cephadm_module.exit_host_maintenance(hostname)
|
||||
assert retval.exception_str
|
||||
assert not retval.result_str()
|
||||
|
||||
with pytest.raises(OrchestratorError, match='Failed to exit maintenance state for host host1, cluster fsid'):
|
||||
cephadm_module.exit_host_maintenance(hostname)
|
||||
|
||||
assert cephadm_module.inventory._inventory[hostname]['status'] == 'maintenance'
|
||||
|
||||
@mock.patch("cephadm.ssh.SSHManager._remote_connection")
|
||||
|
@ -125,6 +125,9 @@ def handle_orch_error(f: Callable[..., T]) -> Callable[..., 'OrchResult[T]']:
|
||||
return OrchResult(f(*args, **kwargs))
|
||||
except Exception as e:
|
||||
logger.exception(e)
|
||||
import os
|
||||
if 'UNITTEST' in os.environ:
|
||||
raise # This makes debugging of Tracebacks from unittests a bit easier
|
||||
return OrchResult(None, exception=e)
|
||||
|
||||
return cast(Callable[..., OrchResult[T]], wrapper)
|
||||
|
Loading…
Reference in New Issue
Block a user