]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
mgr/smb: adjust the order of the result object fields 57096/head
authorJohn Mulligan <jmulligan@redhat.com>
Thu, 25 Apr 2024 20:54:31 +0000 (16:54 -0400)
committerJohn Mulligan <jmulligan@redhat.com>
Wed, 1 May 2024 13:29:51 +0000 (09:29 -0400)
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 <jmulligan@redhat.com>
src/pybind/mgr/smb/results.py

index 13d83926a35f2df6fa3f74b050a724b456c22b99..4b958fd7a5ef93984e09d817ca7c60865d03c3a0 100644 (file)
@@ -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: