]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
mgr/nfs/export: nicer exceptions on cap update
authorSage Weil <sage@newdream.net>
Thu, 15 Jul 2021 14:23:50 +0000 (10:23 -0400)
committerSage Weil <sage@newdream.net>
Mon, 26 Jul 2021 20:21:24 +0000 (16:21 -0400)
Signed-off-by: Sage Weil <sage@newdream.net>
src/pybind/mgr/nfs/export.py

index aaf87662a49b39c9e2616ad5a5291931a9bebe07..7724c63b99e9d8594b1039655130f402a2d5869a 100644 (file)
@@ -475,17 +475,21 @@ class ExportMgr:
             'format': 'json',
         })
         if ret == -errno.EINVAL and 'does not match' in err:
-            ret, out, err = self.mgr.check_mon_command({
+            ret, out, err = self.mgr.mon_command({
                 'prefix': 'auth caps',
                 'entity': 'client.{}'.format(entity),
                 'caps': nfs_caps,
                 'format': 'json',
             })
-            ret, out, err = self.mgr.check_mon_command({
+            if err:
+                raise NFSException(f'Failed to update caps for {entity}: {err}')
+            ret, out, err = self.mgr.mon_command({
                 'prefix': 'auth get',
                 'entity': 'client.{}'.format(entity),
                 'format': 'json',
             })
+            if err:
+                raise NFSException(f'Failed to fetch caps for {entity}: {err}')
 
         json_res = json.loads(out)
         log.info("Export user created is {}".format(json_res[0]['entity']))