]> git.proxmox.com Git - ceph.git/blobdiff - ceph/src/pybind/mgr/selftest/module.py
import ceph 15.2.14
[ceph.git] / ceph / src / pybind / mgr / selftest / module.py
index f62d968c8988f06147f810de2711f81c036f27f6..9ed5e342ee295d9b33d938f4c40a6738ff2d9e43 100644 (file)
@@ -1,10 +1,11 @@
 
 from mgr_module import MgrModule, CommandResult
-import threading
-import random
-import json
 import errno
 import six
+import json
+import random
+import sys
+import threading
 
 
 class Module(MgrModule):
@@ -101,6 +102,11 @@ class Module(MgrModule):
                 "desc": "Create an audit log record.",
                 "perm": "rw"
             },
+            {
+                "cmd": "mgr self-test python-version",
+                "desc": "Query the version of the embedded Python runtime",
+                "perm": "r"
+            },
             ]
 
     def __init__(self, *args, **kwargs):
@@ -110,7 +116,13 @@ class Module(MgrModule):
         self._health = {}
 
     def handle_command(self, inbuf, command):
-        if command['prefix'] == 'mgr self-test run':
+        if command['prefix'] == 'mgr self-test python-version':
+            major = sys.version_info.major
+            minor = sys.version_info.minor
+            micro = sys.version_info.micro
+            return 0, f'{major}.{minor}.{micro}', ''
+
+        elif command['prefix'] == 'mgr self-test run':
             self._self_test()
             return 0, '', 'Self-test succeeded'