]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
pybind/mgr: clean up various whitespace issues in mgr_module.py
authorJohn Mulligan <jmulligan@redhat.com>
Tue, 7 May 2024 17:28:13 +0000 (13:28 -0400)
committerJohn Mulligan <jmulligan@redhat.com>
Thu, 13 Jun 2024 14:14:29 +0000 (10:14 -0400)
Cleans up a bunch of non-pep8 compliant formatting wrt whitespace.

Signed-off-by: John Mulligan <jmulligan@redhat.com>
src/pybind/mgr/mgr_module.py

index 2d57dfe6cdac817cae953c55e54ce57926e27457..b216d124490a1f39da7d9c19be492d9d34535c7b 100644 (file)
@@ -84,6 +84,7 @@ PG_STATES = [
 NFS_GANESHA_SUPPORTED_FSALS = ['CEPH', 'RGW']
 NFS_POOL_NAME = '.nfs'
 
+
 class CephReleases(IntEnum):
     argonaut = 1
     bobtail = 2
@@ -106,6 +107,7 @@ class CephReleases(IntEnum):
     squid = 19
     maximum = 20
 
+
 class NotifyType(str, Enum):
     mon_map = 'mon_map'
     pg_summary = 'pg_summary'
@@ -165,8 +167,12 @@ class HandleCommandResult(NamedTuple):
     stderr: str = ""            # Typically used for error messages.
 
 
-class MonCommandFailed(RuntimeError): pass
-class MgrDBNotReady(RuntimeError): pass
+class MonCommandFailed(RuntimeError):
+    pass
+
+
+class MgrDBNotReady(RuntimeError):
+    pass
 
 
 class OSDMap(ceph_module.BasePyOSDMap):
@@ -355,6 +361,7 @@ class CRUSHMap(ceph_module.BasePyCRUSH):
 
 HandlerFuncType = Callable[..., Tuple[int, str, str]]
 
+
 def _extract_target_func(
     f: HandlerFuncType
 ) -> Tuple[HandlerFuncType, Dict[str, Any]]:
@@ -538,9 +545,12 @@ def CLICheckNonemptyFileInput(desc: str) -> Callable[[HandlerFuncType], HandlerF
         return check
     return CheckFileInput
 
+
 # If the mgr loses its lock on the database because e.g. the pgs were
 # transiently down, then close it and allow it to be reopened.
 MAX_DBCLEANUP_RETRIES = 3
+
+
 def MgrModuleRecoverDB(func: Callable) -> Callable:
     @functools.wraps(func)
     def check(self: MgrModule, *args: Any, **kwargs: Any) -> Any:
@@ -560,6 +570,7 @@ def MgrModuleRecoverDB(func: Callable) -> Callable:
     check.__signature__ = inspect.signature(func)  # type: ignore[attr-defined]
     return check
 
+
 def CLIRequiresDB(func: HandlerFuncType) -> HandlerFuncType:
     @functools.wraps(func)
     def check(self: MgrModule, *args: Any, **kwargs: Any) -> Tuple[int, str, str]:
@@ -569,6 +580,7 @@ def CLIRequiresDB(func: HandlerFuncType) -> HandlerFuncType:
     check.__signature__ = inspect.signature(func)  # type: ignore[attr-defined]
     return check
 
+
 def _get_localized_key(prefix: str, key: str) -> str:
     return '{}/{}'.format(prefix, key)
 
@@ -584,12 +596,14 @@ if TYPE_CHECKING:
 # common/options.h: value_t
 OptionValue = Optional[Union[bool, int, float, str]]
 
+
 class OptionLevel(IntEnum):
     BASIC = 0
     ADVANCED = 1
     DEV = 2
     UNKNOWN = 3
 
+
 class Option(Dict):
     """
     Helper class to declare options for MODULE_OPTIONS list.
@@ -997,8 +1011,8 @@ class MgrModule(ceph_module.BaseMgrModule, MgrModuleLoggingMixin):
     MODULE_OPTION_DEFAULTS = {}  # type: Dict[str, Any]
 
     # Database Schema
-    SCHEMA = None # type: Optional[List[str]]
-    SCHEMA_VERSIONED = None # type: Optional[List[List[str]]]
+    SCHEMA = None  # type: Optional[List[str]]
+    SCHEMA_VERSIONED = None  # type: Optional[List[List[str]]]
 
     # Priority definitions for perf counters
     PRIO_CRITICAL = 10
@@ -1058,7 +1072,7 @@ class MgrModule(ceph_module.BaseMgrModule, MgrModuleLoggingMixin):
         # for backwards compatibility
         self._logger = self.getLogger()
 
-        self._db = None # type: Optional[sqlite3.Connection]
+        self._db = None  # type: Optional[sqlite3.Connection]
 
         self._version = self._ceph_get_version()
 
@@ -1294,7 +1308,7 @@ class MgrModule(ceph_module.BaseMgrModule, MgrModuleLoggingMixin):
         uri = f"file:///{self.MGR_POOL_NAME}:{self.module_name}/main.db?vfs=ceph"
         self.log.debug(f"using uri {uri}")
         try:
-            db = sqlite3.connect(uri, check_same_thread=False, uri=True, autocommit=False) # type: ignore[call-arg]
+            db = sqlite3.connect(uri, check_same_thread=False, uri=True, autocommit=False)  # type: ignore[call-arg]
         except TypeError:
             db = sqlite3.connect(uri, check_same_thread=False, uri=True, isolation_level=None)
         # if libcephsqlite reconnects, update the addrv for blocklist
@@ -1765,7 +1779,7 @@ class MgrModule(ceph_module.BaseMgrModule, MgrModuleLoggingMixin):
         for fs in self.get("fs_map")['filesystems']:
             if fscid != fs["id"]:
                 continue
-            
+
             # quiesce leader is the lowest rank
             # with the highest state
             mdsmap = fs["mdsmap"]
@@ -1802,7 +1816,7 @@ class MgrModule(ceph_module.BaseMgrModule, MgrModuleLoggingMixin):
             command: str,
             tag: str,
             inbuf: Optional[str] = None,
-            *, # kw-only args go below
+            *,  # kw-only args go below
             one_shot: bool = False) -> None:
         """
         Called by the plugin to send a command to the mon
@@ -2397,7 +2411,6 @@ class MgrModule(ceph_module.BaseMgrModule, MgrModuleLoggingMixin):
         return self._ceph_remove_mds_perf_query(query_id)
 
     @API.expose
-
     def reregister_mds_perf_queries(self) -> None:
         """
         Re-register MDS perf queries.