From 791d8be5c0ca0f6bb8bc0a036ffad4cda7a26388 Mon Sep 17 00:00:00 2001 From: Melissa Date: Tue, 20 Jul 2021 23:46:41 -0400 Subject: [PATCH] mgr/cephadm: replace instances of remoto/execnet with asyncssh Fixes: https://tracker.ceph.com/issues/44676 Signed-off-by: Melissa Li --- ceph.spec.in | 2 +- src/cephadm/cephadm | 2 +- src/mypy.ini | 5 +---- src/pybind/mgr/cephadm/module.py | 22 ++++++---------------- src/pybind/mgr/cephadm/serve.py | 7 +------ src/pybind/mgr/requirements.txt | 3 +-- 6 files changed, 11 insertions(+), 30 deletions(-) diff --git a/ceph.spec.in b/ceph.spec.in index b12a56c57486c..06ab52f1e8f19 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 c9da423918cb9..81baa4d8f0aa7 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 89a80afa9c7eb..63829faa8738a 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 b278cc54b87f9..445c95f63959f 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 915b93b7c5d53..a10c6a660aae9 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 88b9c1b855b9e..ccc3b1f414f78 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 -- 2.39.5