From 8ceea1961f818dc2d07edf9c256ebe5150b6b133 Mon Sep 17 00:00:00 2001 From: Sage Weil Date: Mon, 15 Mar 2021 11:55:36 -0500 Subject: [PATCH] mgr/cephadm: tolerate failure to update daemon caps If we're upgrading from 15.2.0, we may fail to update caps. Instead of failing the upgrade hard, warn to the log and continue. This is less than ideal, but the caps will get corrected the next time the daemon is redeployed on the next upgrade, and most likely the previous caps will continue to work (given they were presumably working before the upgrade). Signed-off-by: Sage Weil --- src/pybind/mgr/cephadm/services/cephadmservice.py | 4 +++- src/pybind/mgr/cephadm/tests/test_services.py | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/pybind/mgr/cephadm/services/cephadmservice.py b/src/pybind/mgr/cephadm/services/cephadmservice.py index 103fcb78c21..0816a84277d 100644 --- a/src/pybind/mgr/cephadm/services/cephadmservice.py +++ b/src/pybind/mgr/cephadm/services/cephadmservice.py @@ -147,11 +147,13 @@ class CephadmService(metaclass=ABCMeta): 'caps': caps, }) if err: - ret, out, err = self.mgr.check_mon_command({ + ret, out, err = self.mgr.mon_command({ 'prefix': 'auth caps', 'entity': entity, 'caps': caps, }) + if err: + self.mgr.log.warning(f"Unable to update caps for {entity}") return keyring def _inventory_get_addr(self, hostname: str) -> str: diff --git a/src/pybind/mgr/cephadm/tests/test_services.py b/src/pybind/mgr/cephadm/tests/test_services.py index 2c3e036a6ef..2c2bdfb3584 100644 --- a/src/pybind/mgr/cephadm/tests/test_services.py +++ b/src/pybind/mgr/cephadm/tests/test_services.py @@ -19,7 +19,9 @@ class FakeMgr: def __init__(self): self.config = '' self.check_mon_command = MagicMock(side_effect=self._check_mon_command) + self.mon_command = MagicMock(side_effect=self._check_mon_command) self.template = MagicMock() + self.log = MagicMock() def _check_mon_command(self, cmd_dict, inbuf=None): prefix = cmd_dict.get('prefix') @@ -114,7 +116,7 @@ class TestCephadmService: 'caps': expected_caps}) assert expected_call in mgr.check_mon_command.mock_calls - assert expected_call2 in mgr.check_mon_command.mock_calls + assert expected_call2 in mgr.mon_command.mock_calls def test_get_auth_entity(self): mgr = FakeMgr() -- 2.39.5