From b73f73074941ca0f34d7e26a1705b86453549bfc Mon Sep 17 00:00:00 2001 From: Sage Weil Date: Thu, 15 Jul 2021 10:23:50 -0400 Subject: [PATCH] mgr/nfs/export: nicer exceptions on cap update Signed-off-by: Sage Weil --- src/pybind/mgr/nfs/export.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/pybind/mgr/nfs/export.py b/src/pybind/mgr/nfs/export.py index aaf87662a49..7724c63b99e 100644 --- a/src/pybind/mgr/nfs/export.py +++ b/src/pybind/mgr/nfs/export.py @@ -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'])) -- 2.39.5