]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
mgr/cephadm: tolerate failure to update daemon caps 40071/head
authorSage Weil <sage@newdream.net>
Mon, 15 Mar 2021 16:55:36 +0000 (11:55 -0500)
committerSage Weil <sage@newdream.net>
Mon, 15 Mar 2021 16:55:36 +0000 (11:55 -0500)
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 <sage@newdream.net>
src/pybind/mgr/cephadm/services/cephadmservice.py
src/pybind/mgr/cephadm/tests/test_services.py

index 103fcb78c219b16f77aedbf74bac339c2dd882a9..0816a84277d5e0d2a5e582b9a606ea22b44950fc 100644 (file)
@@ -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:
index 2c3e036a6ef45a75215e462b6a0f9fd073037d4c..2c2bdfb3584eb65aae58b22a6bc58b2b831458f7 100644 (file)
@@ -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()