summaryrefslogtreecommitdiffstats
path: root/src/pybind/mgr/mgr_module.py
diff options
context:
space:
mode:
authorSage Weil <sage@redhat.com>2018-12-31 22:24:26 +0100
committerSage Weil <sage@redhat.com>2018-12-31 22:24:26 +0100
commit3c9a562755d707875a8658f03915c7ef27775321 (patch)
treeaa637f2b4d502098529ec0bdd0e97a7b4590f4e9 /src/pybind/mgr/mgr_module.py
parentMerge pull request #25437 from Aran85/fix-objecter-reset (diff)
parentmgr/hello: Make use of `HandleCommandResult`. (diff)
downloadceph-3c9a562755d707875a8658f03915c7ef27775321.tar.xz
ceph-3c9a562755d707875a8658f03915c7ef27775321.zip
Merge PR #25408 into master
* refs/pull/25408/head: mgr/hello: Make use of `HandleCommandResult`. Reviewed-by: Sage Weil <sage@redhat.com>
Diffstat (limited to 'src/pybind/mgr/mgr_module.py')
-rw-r--r--src/pybind/mgr/mgr_module.py19
1 files changed, 15 insertions, 4 deletions
diff --git a/src/pybind/mgr/mgr_module.py b/src/pybind/mgr/mgr_module.py
index e425d129b8a..7a7e0db6e7d 100644
--- a/src/pybind/mgr/mgr_module.py
+++ b/src/pybind/mgr/mgr_module.py
@@ -106,14 +106,25 @@ class CommandResult(object):
class HandleCommandResult(namedtuple('HandleCommandResult', ['retval', 'stdout', 'stderr'])):
- def __new__(cls, retval=0, odata="", rs=""):
+ def __new__(cls, retval=0, stdout="", stderr=""):
"""
Tuple containing the result of `handle_command()`
+
+ Only write to stderr if there is an error, or in extraordinary circumstances
+
+ Avoid having `ceph foo bar` commands say "did foo bar" on success unless there
+ is critical information to include there.
+
+ Everything programmatically consumable should be put on stdout
+
:param retval: return code. E.g. 0 or -errno.EINVAL
- :param odata: data of this result.
- :param rs: Typically used for error or status messages.
+ :type retval: int
+ :param stdout: data of this result.
+ :type stdout: str
+ :param stderr: Typically used for error messages.
+ :type stderr: str
"""
- return super(HandleCommandResult, cls).__new__(cls, retval, odata, rs)
+ return super(HandleCommandResult, cls).__new__(cls, retval, stdout, stderr)
class OSDMap(ceph_module.BasePyOSDMap):