From: Sage Weil Date: Mon, 15 Mar 2021 16:55:36 +0000 (-0500) Subject: mgr/cephadm: tolerate failure to update daemon caps X-Git-Tag: v17.1.0~2610^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=refs%2Fpull%2F40071%2Fhead;p=ceph.git 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 --- diff --git a/src/pybind/mgr/cephadm/services/cephadmservice.py b/src/pybind/mgr/cephadm/services/cephadmservice.py index 103fcb78c219..0816a84277d5 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 2c3e036a6ef4..2c2bdfb3584e 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()