From: Melissa Date: Wed, 21 Jul 2021 03:46:41 +0000 (-0400) Subject: mgr/cephadm: replace instances of remoto/execnet with asyncssh X-Git-Tag: v17.1.0~1051^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=refs%2Fpull%2F42051%2Fhead;p=ceph.git mgr/cephadm: replace instances of remoto/execnet with asyncssh Fixes: https://tracker.ceph.com/issues/44676 Signed-off-by: Melissa Li --- diff --git a/ceph.spec.in b/ceph.spec.in index b12a56c57486..06ab52f1e8f1 100644 --- a/ceph.spec.in +++ b/ceph.spec.in @@ -672,7 +672,7 @@ BuildArch: noarch Group: System/Filesystems %endif Requires: ceph-mgr = %{_epoch_prefix}%{version}-%{release} -Requires: python%{python3_pkgversion}-remoto +Requires: python%{python3_pkgversion}-asyncssh Requires: cephadm = %{_epoch_prefix}%{version}-%{release} %if 0%{?suse_version} Requires: openssh diff --git a/src/cephadm/cephadm b/src/cephadm/cephadm index c9da423918cb..81baa4d8f0aa 100755 --- a/src/cephadm/cephadm +++ b/src/cephadm/cephadm @@ -7577,7 +7577,7 @@ WantedBy=ceph-{fsid}.target with open(os.open(os.path.join(self.daemon_path, filename), os.O_CREAT | os.O_WRONLY, mode=0o600), 'w') as f: f.write(config[filename]) - # When __file__ is we're being invoked over remoto via the orchestrator, so + # When __file__ is we're being invoked over asyncssh via the orchestrator, so # we pick up the file from where the orchestrator placed it - otherwise we'll # copy it to the binary location for this cluster if not __file__ == '': diff --git a/src/mypy.ini b/src/mypy.ini index 89a80afa9c7e..63829faa8738 100755 --- a/src/mypy.ini +++ b/src/mypy.ini @@ -36,10 +36,7 @@ ignore_missing_imports = True [mypy-urllib3.*] ignore_missing_imports = True -[mypy-execnet.*] -ignore_missing_imports = True - -[mypy-remoto.*] +[mypy-asyncssh.*] ignore_missing_imports = True [mypy-kubernetes.*] diff --git a/src/pybind/mgr/cephadm/module.py b/src/pybind/mgr/cephadm/module.py index b278cc54b87f..445c95f63959 100644 --- a/src/pybind/mgr/cephadm/module.py +++ b/src/pybind/mgr/cephadm/module.py @@ -62,20 +62,10 @@ from .utils import CEPH_IMAGE_TYPES, forall_hosts, cephadmNoImage from .configchecks import CephadmConfigChecks try: - import remoto - # NOTE(mattoliverau) Patch remoto until remoto PR - # (https://github.com/alfredodeza/remoto/pull/56) lands - from distutils.version import StrictVersion - if StrictVersion(remoto.__version__) <= StrictVersion('1.2'): - def remoto_has_connection(self: Any) -> bool: - return self.gateway.hasreceiver() - - from remoto.backends import BaseConnection - BaseConnection.has_connection = remoto_has_connection - import remoto.process + import asyncssh except ImportError as e: - remoto = None - remoto_import_error = str(e) + asyncssh = None + asyncssh_import_error = str(e) logger = logging.getLogger(__name__) @@ -648,11 +638,11 @@ class CephadmOrchestrator(orchestrator.Orchestrator, MgrModule, @staticmethod def can_run() -> Tuple[bool, str]: - if remoto is not None: + if asyncssh is not None: return True, "" else: - return False, "loading remoto library:{}".format( - remoto_import_error) + return False, "loading asyncssh library:{}".format( + asyncssh_import_error) def available(self) -> Tuple[bool, str, Dict[str, Any]]: """ diff --git a/src/pybind/mgr/cephadm/serve.py b/src/pybind/mgr/cephadm/serve.py index 915b93b7c5d5..a10c6a660aae 100644 --- a/src/pybind/mgr/cephadm/serve.py +++ b/src/pybind/mgr/cephadm/serve.py @@ -3,12 +3,7 @@ import json import logging import uuid from collections import defaultdict -from typing import TYPE_CHECKING, Optional, List, cast, Dict, Any, Union, Tuple, Iterator -try: - import remoto - import execnet.gateway_bootstrap -except ImportError: - remoto = None +from typing import TYPE_CHECKING, Optional, List, cast, Dict, Any, Union, Tuple from ceph.deployment import inventory from ceph.deployment.drive_group import DriveGroupSpec diff --git a/src/pybind/mgr/requirements.txt b/src/pybind/mgr/requirements.txt index 88b9c1b855b9..ccc3b1f414f7 100644 --- a/src/pybind/mgr/requirements.txt +++ b/src/pybind/mgr/requirements.txt @@ -5,7 +5,6 @@ requests-mock pyyaml prettytable pyOpenSSL -execnet -remoto Jinja2 pyfakefs +asyncssh