]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
mgr/mgr_module: Allow resetting module options 29042/head
authorSebastian Wagner <sebastian.wagner@suse.com>
Mon, 15 Jul 2019 11:25:39 +0000 (13:25 +0200)
committerSebastian Wagner <sebastian.wagner@suse.com>
Wed, 17 Jul 2019 13:41:45 +0000 (15:41 +0200)
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>
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 1ad340c731fb2c807d807b5ff594256339dc8d36..38684229b1155f7b8e1f69316d5943741e9edc40 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 bdd0b26cc390898dea88a62ae67720b16ef4995d..00d45ddd5974c7e177d58e6223d11d022eea6a8c 100644 (file)
@@ -1012,7 +1012,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 30740a283897698613db010eacc7f80a3fa305e9..ebf9740a647070961b69d149abd5a2155a84328e 100644 (file)
@@ -378,7 +378,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()
 
@@ -428,3 +428,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)