]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
cephadm: update extract_uid_gid function annotations & format
authorJohn Mulligan <jmulligan@redhat.com>
Thu, 19 Oct 2023 13:46:58 +0000 (09:46 -0400)
committerJohn Mulligan <jmulligan@redhat.com>
Fri, 3 Nov 2023 15:24:51 +0000 (11:24 -0400)
Update the type annotations of extract_uid_gid to the type annotations
form used in more recent python versions. Reformat the function.

Signed-off-by: John Mulligan <jmulligan@redhat.com>
src/cephadm/cephadmlib/container_types.py

index 913a9cfe312e54e4732d48f0c94adfba25c18e27..7ec323acf314e6873ecd8171044e8f6823229f35 100644 (file)
@@ -487,8 +487,11 @@ def get_running_container_name(
     return None
 
 
-def extract_uid_gid(ctx, img='', file_path='/var/lib/ceph'):
-    # type: (CephadmContext, str, Union[str, List[str]]) -> Tuple[int, int]
+def extract_uid_gid(
+    ctx: CephadmContext,
+    img: str = '',
+    file_path: Union[str, List[str]] = '/var/lib/ceph',
+) -> Tuple[int, int]:
 
     if not img:
         img = ctx.image
@@ -503,10 +506,7 @@ def extract_uid_gid(ctx, img='', file_path='/var/lib/ceph'):
     for fp in paths:
         try:
             out = CephContainer(
-                ctx,
-                image=img,
-                entrypoint='stat',
-                args=['-c', '%u %g', fp]
+                ctx, image=img, entrypoint='stat', args=['-c', '%u %g', fp]
             ).run(verbosity=CallVerbosity.QUIET_UNLESS_ERROR)
             uid, gid = out.split(' ')
             return int(uid), int(gid)