]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
mgr/mgr_module: Allow resetting module options 29550/head
authorSebastian Wagner <sebastian.wagner@suse.com>
Mon, 15 Jul 2019 11:25:39 +0000 (13:25 +0200)
committerPrashant D <pdhange@redhat.com>
Thu, 8 Aug 2019 09:22:13 +0000 (05:22 -0400)
Introduced in 4872cc5aa32611e44705aebf93145a92d5df776a

`_ceph_set_module_option` also accepts `None`, not just strings.

Fixes: http://tracker.ceph.com/issues/40779
Signed-off-by: Sebastian Wagner <sebastian.wagner@suse.com>
(cherry picked from commit 03424798356532cf70841fb189718a8534b4e356)

doc/mgr/orchestrator_cli.rst
qa/tasks/mgr/test_module_selftest.py
src/pybind/mgr/mgr_module.py
src/pybind/mgr/orchestrator_cli/module.py

index 7fa1434078d2eaf2a6fb2326dc13ecb019634fa4..6ee378457f0d19ab149ec26684a5d81c81f7b8fc 100644 (file)
@@ -69,7 +69,7 @@ Disable the Orchestrator
 To disable the orchestrator again, use the empty string ``""``::
 
     ceph orchestrator set backend ""``
-    ceph mgr module disalbe rook
+    ceph mgr module disable rook
 
 Usage
 =====
index 7e6a5110c9dce28e597e5bc87833561bf1577c22..bec2786c33d3d5c894a3f3c96c36ad13460bb3d5 100644 (file)
@@ -78,6 +78,10 @@ class TestModuleSelftest(MgrTestCase):
     def test_crash(self):
         self._selftest_plugin("crash")
 
+    def test_orchestrator_cli(self):
+        self._selftest_plugin("orchestrator_cli")
+
+
     def test_selftest_config_update(self):
         """
         That configuration updates are seen by running mgr modules
index ba36be96e5d2a10875722540869fe27f6d75f739..9d4bcb41cc77ff9cdeae8c3c811f6062d880f921 100644 (file)
@@ -1017,7 +1017,8 @@ class MgrModule(ceph_module.BaseMgrModule):
         return self._get_module_option(key, default, self.get_mgr_id())
 
     def _set_module_option(self, key, val):
-        return self._ceph_set_module_option(self.module_name, key, str(val))
+        return self._ceph_set_module_option(self.module_name, key,
+                                            None if val is None else str(val))
 
     def set_module_option(self, key, val):
         """
index 458d53a0452cb36702041755a72fe8be5518e8e5..6225b5ad66b111b5e4de074c60a9f093a38673b4 100644 (file)
@@ -379,7 +379,7 @@ Usage:
         """
         mgr_map = self.get("mgr_map")
 
-        if module_name == "":
+        if module_name is None or module_name == "":
             self.set_module_option("orchestrator", None)
             return HandleCommandResult()
 
@@ -429,3 +429,9 @@ Usage:
                                            o, avail,
                                            " ({0})".format(why) if not avail else ""
                                        ))
+
+    def self_test(self):
+        old_orch = self._select_orchestrator()
+        self._set_backend('')
+        assert self._select_orchestrator() is None
+        self._set_backend(old_orch)