From 76d3f0d537dc35dea065177925fd82ed65f3e564 Mon Sep 17 00:00:00 2001 From: Tim Serong Date: Fri, 19 Oct 2018 19:25:45 +1100 Subject: [PATCH] mgr/orchestrator: use result property in Completion classes The _Completion class defined a get_result() method, but the orchestrator CLI and Rook module both just expected a result property, so let's run with the property version. Signed-off-by: Tim Serong --- src/pybind/mgr/orchestrator.py | 3 ++- src/pybind/mgr/rook/module.py | 8 ++++++-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/src/pybind/mgr/orchestrator.py b/src/pybind/mgr/orchestrator.py index 43eee7da630d..a66ff53ffd32 100644 --- a/src/pybind/mgr/orchestrator.py +++ b/src/pybind/mgr/orchestrator.py @@ -7,7 +7,8 @@ Please see the ceph-mgr module developer's guide for more information. class _Completion(object): - def get_result(self): + @property + def result(self): """ Return the result of the operation that we were waited for. Only valid after calling Orchestrator.wait() on this diff --git a/src/pybind/mgr/rook/module.py b/src/pybind/mgr/rook/module.py index aadbdd50535f..bbc0ceebb7a3 100644 --- a/src/pybind/mgr/rook/module.py +++ b/src/pybind/mgr/rook/module.py @@ -33,7 +33,7 @@ class RookReadCompletion(orchestrator.ReadCompletion): def __init__(self, cb): super(RookReadCompletion, self).__init__() self.cb = cb - self.result = None + self._result = None self._complete = False self.message = "" @@ -42,12 +42,16 @@ class RookReadCompletion(orchestrator.ReadCompletion): global all_completions all_completions.append(self) + @property + def result(self): + return self._result + @property def is_complete(self): return self._complete def execute(self): - self.result = self.cb() + self._result = self.cb() self._complete = True -- 2.47.3