From c61a0103c2bba1b20e299fae72db2119b6669026 Mon Sep 17 00:00:00 2001 From: John Mulligan Date: Thu, 25 Apr 2024 16:54:31 -0400 Subject: [PATCH] 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 --- src/pybind/mgr/smb/results.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) 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: -- 2.47.3