summaryrefslogtreecommitdiffstats
path: root/src/cephadm/tests/test_cephadm.py
diff options
context:
space:
mode:
authorJohn Mulligan <jmulligan@redhat.com>2024-03-27 23:45:15 +0100
committerJohn Mulligan <jmulligan@redhat.com>2024-03-28 15:39:06 +0100
commit0a137b140e47d02b03d133adb55e62aa0de7b984 (patch)
tree92a7cb3786a413b6bc588873e820b54538eb517e /src/cephadm/tests/test_cephadm.py
parentMerge pull request #56543 from jrchyang/main (diff)
downloadceph-0a137b140e47d02b03d133adb55e62aa0de7b984.tar.xz
ceph-0a137b140e47d02b03d133adb55e62aa0de7b984.zip
cephadm: fix host-maintenance command always exiting with a failure
The host-maintenance command would always fail because command_maintenance always returns a string. This string is passed to sys.exit and thus always gets printed and causes a non-zero exit code. Fix the command line behavior by renaming the original function and adding a new command_maintenance that prints the string and returns an int like other command_* functions do. Fixes: https://tracker.ceph.com/issues/65122 Signed-off-by: John Mulligan <jmulligan@redhat.com>
Diffstat (limited to 'src/cephadm/tests/test_cephadm.py')
-rw-r--r--src/cephadm/tests/test_cephadm.py8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/cephadm/tests/test_cephadm.py b/src/cephadm/tests/test_cephadm.py
index 59d360b15b8..6a5f4c9f00c 100644
--- a/src/cephadm/tests/test_cephadm.py
+++ b/src/cephadm/tests/test_cephadm.py
@@ -1239,7 +1239,7 @@ class TestMaintenance:
ctx: _cephadm.CephadmContext = _cephadm.cephadm_init_ctx(
['host-maintenance', 'enter', '--fsid', TestMaintenance.fsid])
ctx.container_engine = mock_podman()
- retval = _cephadm.command_maintenance(ctx)
+ retval = _cephadm.change_maintenance_mode(ctx)
assert retval.startswith('failed')
@mock.patch('os.listdir', return_value=[])
@@ -1252,7 +1252,7 @@ class TestMaintenance:
ctx: _cephadm.CephadmContext = _cephadm.cephadm_init_ctx(
['host-maintenance', 'enter', '--fsid', TestMaintenance.fsid])
ctx.container_engine = mock_podman()
- retval = _cephadm.command_maintenance(ctx)
+ retval = _cephadm.change_maintenance_mode(ctx)
assert retval.startswith('failed')
@mock.patch('os.listdir', return_value=[])
@@ -1267,7 +1267,7 @@ class TestMaintenance:
ctx: _cephadm.CephadmContext = _cephadm.cephadm_init_ctx(
['host-maintenance', 'exit', '--fsid', TestMaintenance.fsid])
ctx.container_engine = mock_podman()
- retval = _cephadm.command_maintenance(ctx)
+ retval = _cephadm.change_maintenance_mode(ctx)
assert retval.startswith('failed')
@mock.patch('os.listdir', return_value=[])
@@ -1282,7 +1282,7 @@ class TestMaintenance:
ctx: _cephadm.CephadmContext = _cephadm.cephadm_init_ctx(
['host-maintenance', 'exit', '--fsid', TestMaintenance.fsid])
ctx.container_engine = mock_podman()
- retval = _cephadm.command_maintenance(ctx)
+ retval = _cephadm.change_maintenance_mode(ctx)
assert retval.startswith('failed')