From: John Mulligan Date: Thu, 19 Oct 2023 13:46:58 +0000 (-0400) Subject: cephadm: update extract_uid_gid function annotations & format X-Git-Tag: v19.0.0~170^2 X-Git-Url: http://git.apps.os.sepia.ceph.com/?a=commitdiff_plain;h=d8860c1336d2bf8c32d2105072ce153827452d74;p=ceph-ci.git cephadm: update extract_uid_gid function annotations & format 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 --- diff --git a/src/cephadm/cephadmlib/container_types.py b/src/cephadm/cephadmlib/container_types.py index 913a9cfe312..7ec323acf31 100644 --- a/src/cephadm/cephadmlib/container_types.py +++ b/src/cephadm/cephadmlib/container_types.py @@ -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)