From: John Mulligan Date: Thu, 25 Apr 2024 20:54:31 +0000 (-0400) Subject: mgr/smb: adjust the order of the result object fields X-Git-Tag: v20.0.0~1971^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=refs%2Fpull%2F57096%2Fhead;p=ceph.git mgr/smb: adjust the order of the result object fields When generating JSON/YAML from result objects make the status information and success field placed after the resource summary. This makes it easier to find these fields when reading the output of a command (at least for this reader). Signed-off-by: John Mulligan --- diff --git a/src/pybind/mgr/smb/results.py b/src/pybind/mgr/smb/results.py index 13d83926a35..4b958fd7a5e 100644 --- a/src/pybind/mgr/smb/results.py +++ b/src/pybind/mgr/smb/results.py @@ -26,11 +26,13 @@ class Result: self.status = status def to_simplified(self) -> Simplified: - ds: Simplified = dict(self.status or {}) + ds: Simplified = {} ds['resource'] = self.src.to_simplified() - ds['success'] = self.success + if self.status: + ds.update(self.status) if self.msg: ds['msg'] = self.msg + ds['success'] = self.success return ds def mgr_return_value(self) -> int: @@ -77,8 +79,8 @@ class ResultGroup: def to_simplified(self) -> Simplified: return { - 'success': self.success, 'results': [r.to_simplified() for r in self._contents], + 'success': self.success, } def mgr_return_value(self) -> int: