From: Joao Eduardo Luis Date: Thu, 14 Jan 2021 15:34:55 +0000 (-0100) Subject: cephadm: drop ctx class from where we don't need it X-Git-Tag: v17.0.0~8^2~4 X-Git-Url: http://git.apps.os.sepia.ceph.com/?a=commitdiff_plain;h=b56eb958dfef75d7e181fdbaae9a7817887a0b6a;p=ceph-ci.git cephadm: drop ctx class from where we don't need it Signed-off-by: Joao Eduardo Luis --- diff --git a/src/cephadm/cephadm b/src/cephadm/cephadm index 3afd98fc266..d87ea4b652b 100755 --- a/src/cephadm/cephadm +++ b/src/cephadm/cephadm @@ -720,10 +720,9 @@ class CustomContainer(object): """Defines a custom container""" daemon_type = 'container' - def __init__(self, ctx: CephadmContext, + def __init__(self, fsid: str, daemon_id: Union[int, str], config_json: Dict, image: str) -> None: - self.ctx = ctx self.fsid = fsid self.daemon_id = daemon_id self.image = image @@ -744,7 +743,7 @@ class CustomContainer(object): @classmethod def init(cls, ctx: CephadmContext, fsid: str, daemon_id: Union[int, str]) -> 'CustomContainer': - return cls(ctx, fsid, daemon_id, + return cls(fsid, daemon_id, get_parm(ctx.args.config_json), ctx.args.image) def create_daemon_dirs(self, data_dir: str, uid: int, gid: int) -> None: @@ -924,7 +923,7 @@ def check_ip_port(ctx, ip, port): # type: (CephadmContext, str, int) -> None if not ctx.args.skip_ping_check: logger.info('Verifying IP %s port %d ...' % (ip, port)) - if is_ipv6(ctx, ip): + if is_ipv6(ip): s = socket.socket(socket.AF_INET6, socket.SOCK_STREAM) ip = unwrap_ipv6(ip) else: @@ -1633,11 +1632,11 @@ def get_last_local_ceph_image(ctx: CephadmContext, container_path: str): '--filter', 'label=ceph=True', '--filter', 'dangling=false', '--format', '{{.Repository}}@{{.Digest}}']) - return _filter_last_local_ceph_image(ctx, out) + return _filter_last_local_ceph_image(out) -def _filter_last_local_ceph_image(ctx, out): - # type: (CephadmContext, str) -> Optional[str] +def _filter_last_local_ceph_image(out): + # type: (str) -> Optional[str] for image in out.splitlines(): if image and not image.endswith('@'): logger.info('Using recent ceph image %s' % image) @@ -3087,8 +3086,8 @@ def wrap_ipv6(address): return address -def is_ipv6(ctx, address): - # type: (CephadmContext, str) -> bool +def is_ipv6(address): + # type: (str) -> bool address = unwrap_ipv6(address) try: return ipaddress.ip_address(unicode(address)).version == 6 @@ -3105,7 +3104,7 @@ def prepare_mon_addresses( ipv6 = False if ctx.args.mon_ip: - ipv6 = is_ipv6(ctx, ctx.args.mon_ip) + ipv6 = is_ipv6(ctx.args.mon_ip) if ipv6: ctx.args.mon_ip = wrap_ipv6(ctx.args.mon_ip) hasport = r.findall(ctx.args.mon_ip)