From: Alfredo Deza Date: Fri, 27 Jun 2014 13:16:16 +0000 (-0400) Subject: adapt remoto imports for new optional vendoring X-Git-Tag: v1.5.6~6^2~1 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=a420f6d8d9a4bf6ee88beaccfc76d4042151eb08;p=ceph-deploy.git adapt remoto imports for new optional vendoring Signed-off-by: Alfredo Deza --- diff --git a/ceph_deploy/hosts/centos/install.py b/ceph_deploy/hosts/centos/install.py index d6f605e..f66c91e 100644 --- a/ceph_deploy/hosts/centos/install.py +++ b/ceph_deploy/hosts/centos/install.py @@ -1,5 +1,5 @@ from ceph_deploy.util import pkg_managers, templates -from ceph_deploy.lib.remoto import process +from ceph_deploy.lib import remoto def repository_url_part(distro): @@ -44,7 +44,7 @@ def install(distro, version_kind, version, adjust_repos): key = 'autobuild' if adjust_repos: - process.run( + remoto.process.run( distro.conn, [ 'rpm', @@ -67,7 +67,7 @@ def install(distro, version_kind, version, adjust_repos): version=version, ) - process.run( + remoto.process.run( distro.conn, [ 'rpm', @@ -82,7 +82,7 @@ def install(distro, version_kind, version, adjust_repos): distro.conn.remote_module.set_repo_priority(['Ceph', 'Ceph-noarch', 'ceph-source']) logger.warning('altered ceph.repo priorities to contain: priority=1') - process.run( + remoto.process.run( distro.conn, [ 'yum', @@ -101,7 +101,7 @@ def install_epel(distro): if distro.name.lower() in ['centos', 'scientific']: distro.conn.logger.info('adding EPEL repository') if float(distro.release) >= 6: - process.run( + remoto.process.run( distro.conn, ['wget', 'http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm'], ) @@ -113,7 +113,7 @@ def install_epel(distro): ], ) else: - process.run( + remoto.process.run( distro.conn, ['wget', 'http://dl.fedoraproject.org/pub/epel/5/x86_64/epel-release-5-4.noarch.rpm'], ) @@ -161,7 +161,7 @@ def mirror_install(distro, repo_url, gpg_url, adjust_repos): pkg_managers.yum_clean(distro.conn) if adjust_repos: - process.run( + remoto.process.run( distro.conn, [ 'rpm', @@ -196,7 +196,7 @@ def repo_install(distro, reponame, baseurl, gpgkey, **kw): pkg_managers.yum_clean(distro.conn) if gpgkey: - process.run( + remoto.process.run( distro.conn, [ 'rpm', diff --git a/ceph_deploy/hosts/centos/mon/create.py b/ceph_deploy/hosts/centos/mon/create.py index 16b9f22..d0dddbd 100644 --- a/ceph_deploy/hosts/centos/mon/create.py +++ b/ceph_deploy/hosts/centos/mon/create.py @@ -1,5 +1,5 @@ from ceph_deploy.hosts import common -from ceph_deploy.lib.remoto import process +from ceph_deploy.lib import remoto def create(distro, args, monitor_keyring): @@ -7,7 +7,7 @@ def create(distro, args, monitor_keyring): common.mon_create(distro, args, monitor_keyring, hostname) service = distro.conn.remote_module.which_service() - process.run( + remoto.process.run( distro.conn, [ service, diff --git a/ceph_deploy/hosts/common.py b/ceph_deploy/hosts/common.py index 9639198..b71db9d 100644 --- a/ceph_deploy/hosts/common.py +++ b/ceph_deploy/hosts/common.py @@ -1,6 +1,6 @@ from ceph_deploy.util import paths from ceph_deploy import conf -from ceph_deploy.lib.remoto import process +from ceph_deploy.lib import remoto from StringIO import StringIO @@ -8,7 +8,7 @@ def ceph_version(conn): """ Log the remote ceph-version by calling `ceph --version` """ - return process.run(conn, ['ceph', '--version']) + return remoto.process.run(conn, ['ceph', '--version']) def mon_create(distro, args, monitor_keyring, hostname): @@ -46,7 +46,7 @@ def mon_create(distro, args, monitor_keyring, hostname): monitor_keyring, ) - process.run( + remoto.process.run( distro.conn, [ 'ceph-mon', @@ -104,7 +104,7 @@ def mon_add(distro, args, monitor_keyring): ) # get the monmap - process.run( + remoto.process.run( distro.conn, [ 'ceph', @@ -116,7 +116,7 @@ def mon_add(distro, args, monitor_keyring): ) # now use it to prepare the monitor's data dir - process.run( + remoto.process.run( distro.conn, [ 'ceph-mon', @@ -130,7 +130,7 @@ def mon_add(distro, args, monitor_keyring): ) # add it - process.run( + remoto.process.run( distro.conn, [ 'ceph', @@ -151,7 +151,7 @@ def mon_add(distro, args, monitor_keyring): distro.conn.remote_module.create_init_path(init_path) # start the mon using the address - process.run( + remoto.process.run( distro.conn, [ 'ceph-mon', diff --git a/ceph_deploy/hosts/debian/install.py b/ceph_deploy/hosts/debian/install.py index f8d1b9b..6263689 100644 --- a/ceph_deploy/hosts/debian/install.py +++ b/ceph_deploy/hosts/debian/install.py @@ -1,4 +1,4 @@ -from ceph_deploy.lib.remoto import process +from ceph_deploy.lib import remoto from ceph_deploy.util import pkg_managers @@ -12,7 +12,7 @@ def install(distro, version_kind, version, adjust_repos): key = 'autobuild' # Make sure ca-certificates is installed - process.run( + remoto.process.run( distro.conn, [ 'env', @@ -26,7 +26,7 @@ def install(distro, version_kind, version, adjust_repos): ) if adjust_repos: - process.run( + remoto.process.run( distro.conn, [ 'wget', @@ -37,7 +37,7 @@ def install(distro, version_kind, version, adjust_repos): stop_on_nonzero=False, ) - process.run( + remoto.process.run( distro.conn, [ 'apt-key', @@ -63,13 +63,13 @@ def install(distro, version_kind, version, adjust_repos): distro.conn.remote_module.write_sources_list(url, codename) - process.run( + remoto.process.run( distro.conn, ['apt-get', '-q', 'update'], ) # TODO this does not downgrade -- should it? - process.run( + remoto.process.run( distro.conn, [ 'env', @@ -99,7 +99,7 @@ def mirror_install(distro, repo_url, gpg_url, adjust_repos): if adjust_repos: if not gpg_url.startswith('file://'): - process.run( + remoto.process.run( distro.conn, [ 'wget', @@ -111,7 +111,7 @@ def mirror_install(distro, repo_url, gpg_url, adjust_repos): ) gpg_file = 'release.asc' if not gpg_url.startswith('file://') else gpg_path - process.run( + remoto.process.run( distro.conn, [ 'apt-key', @@ -145,7 +145,7 @@ def repo_install(distro, repo_name, baseurl, gpgkey, **kw): baseurl = baseurl.strip('/') # Remove trailing slashes if gpgkey: - process.run( + remoto.process.run( distro.conn, [ 'wget', @@ -156,7 +156,7 @@ def repo_install(distro, repo_name, baseurl, gpgkey, **kw): stop_on_nonzero=False, ) - process.run( + remoto.process.run( distro.conn, [ 'apt-key', diff --git a/ceph_deploy/hosts/debian/mon/create.py b/ceph_deploy/hosts/debian/mon/create.py index 29fa49c..93d4393 100644 --- a/ceph_deploy/hosts/debian/mon/create.py +++ b/ceph_deploy/hosts/debian/mon/create.py @@ -1,5 +1,5 @@ from ceph_deploy.hosts import common -from ceph_deploy.lib.remoto import process +from ceph_deploy.lib import remoto def create(distro, args, monitor_keyring): @@ -12,7 +12,7 @@ def create(distro, args, monitor_keyring): logger.warning('could not find `service` executable') if distro.init == 'upstart': # Ubuntu uses upstart - process.run( + remoto.process.run( distro.conn, [ 'initctl', @@ -26,7 +26,7 @@ def create(distro, args, monitor_keyring): elif distro.init == 'sysvinit': # Debian uses sysvinit - process.run( + remoto.process.run( distro.conn, [ service, diff --git a/ceph_deploy/hosts/debian/uninstall.py b/ceph_deploy/hosts/debian/uninstall.py index 8ffdca1..f091628 100644 --- a/ceph_deploy/hosts/debian/uninstall.py +++ b/ceph_deploy/hosts/debian/uninstall.py @@ -1,5 +1,5 @@ from ceph_deploy.util import pkg_managers -from ceph_deploy.lib.remoto import process +from ceph_deploy.lib import remoto def uninstall(conn, purge=False): diff --git a/ceph_deploy/hosts/fedora/install.py b/ceph_deploy/hosts/fedora/install.py index f7926f6..7ce5035 100644 --- a/ceph_deploy/hosts/fedora/install.py +++ b/ceph_deploy/hosts/fedora/install.py @@ -1,5 +1,5 @@ from ceph_deploy.util import pkg_managers, templates -from ceph_deploy.lib.remoto import process +from ceph_deploy.lib import remoto from ceph_deploy.hosts.centos.install import repo_install, mirror_install # noqa @@ -14,7 +14,7 @@ def install(distro, version_kind, version, adjust_repos): key = 'autobuild' if adjust_repos: - process.run( + remoto.process.run( distro.conn, [ 'rpm', @@ -39,7 +39,7 @@ def install(distro, version_kind, version, adjust_repos): version=version, ) - process.run( + remoto.process.run( distro.conn, [ 'rpm', @@ -60,7 +60,7 @@ def install(distro, version_kind, version, adjust_repos): logger.warning('altered ceph.repo priorities to contain: priority=1') - process.run( + remoto.process.run( distro.conn, [ 'yum', diff --git a/ceph_deploy/hosts/fedora/mon/create.py b/ceph_deploy/hosts/fedora/mon/create.py index 16b9f22..d0dddbd 100644 --- a/ceph_deploy/hosts/fedora/mon/create.py +++ b/ceph_deploy/hosts/fedora/mon/create.py @@ -1,5 +1,5 @@ from ceph_deploy.hosts import common -from ceph_deploy.lib.remoto import process +from ceph_deploy.lib import remoto def create(distro, args, monitor_keyring): @@ -7,7 +7,7 @@ def create(distro, args, monitor_keyring): common.mon_create(distro, args, monitor_keyring, hostname) service = distro.conn.remote_module.which_service() - process.run( + remoto.process.run( distro.conn, [ service, diff --git a/ceph_deploy/hosts/suse/install.py b/ceph_deploy/hosts/suse/install.py index 030a5e1..d4f27df 100644 --- a/ceph_deploy/hosts/suse/install.py +++ b/ceph_deploy/hosts/suse/install.py @@ -1,5 +1,5 @@ from ceph_deploy.util import templates, pkg_managers -from ceph_deploy.lib.remoto import process +from ceph_deploy.lib import remoto import logging LOG = logging.getLogger(__name__) @@ -32,7 +32,7 @@ def install(distro, version_kind, version, adjust_repos): protocol = "https" if distro_name == 'sles11': protocol = "http" - process.run( + remoto.process.run( distro.conn, [ 'rpm', @@ -58,7 +58,7 @@ def install(distro, version_kind, version, adjust_repos): version=version, ) - process.run( + remoto.process.run( distro.conn, [ 'rpm', @@ -72,7 +72,7 @@ def install(distro, version_kind, version, adjust_repos): ] ) - process.run( + remoto.process.run( distro.conn, [ 'zypper', @@ -89,7 +89,7 @@ def mirror_install(distro, repo_url, gpg_url, adjust_repos): gpg_url_path = gpg_url.split('file://')[-1] # Remove file if present if adjust_repos: - process.run( + remoto.process.run( distro.conn, [ 'rpm', @@ -105,7 +105,7 @@ def mirror_install(distro, repo_url, gpg_url, adjust_repos): distro.conn.remote_module.write_yum_repo(ceph_repo_content) - process.run( + remoto.process.run( distro.conn, [ 'zypper', @@ -128,7 +128,7 @@ def repo_install(distro, reponame, baseurl, gpgkey, **kw): baseurl = baseurl.strip('/') # Remove trailing slashes if gpgkey: - process.run( + remoto.process.run( distro.conn, [ 'rpm', diff --git a/ceph_deploy/hosts/suse/mon/create.py b/ceph_deploy/hosts/suse/mon/create.py index a6c4be2..5c0b9bf 100644 --- a/ceph_deploy/hosts/suse/mon/create.py +++ b/ceph_deploy/hosts/suse/mon/create.py @@ -1,12 +1,12 @@ from ceph_deploy.hosts import common -from ceph_deploy.lib.remoto import process +from ceph_deploy.lib import remoto def create(distro, args, monitor_keyring): hostname = distro.conn.remote_module.shortname() common.mon_create(distro, args, monitor_keyring, hostname) - process.run( + remoto.process.run( distro.conn, [ 'rcceph', diff --git a/ceph_deploy/hosts/suse/uninstall.py b/ceph_deploy/hosts/suse/uninstall.py index 740f6f3..9d815e7 100644 --- a/ceph_deploy/hosts/suse/uninstall.py +++ b/ceph_deploy/hosts/suse/uninstall.py @@ -1,4 +1,4 @@ -from ceph_deploy.lib.remoto import process +from ceph_deploy.lib import remoto def uninstall(conn, purge=False): @@ -16,4 +16,4 @@ def uninstall(conn, purge=False): ] cmd.extend(packages) - process.run(conn, cmd) + remoto.process.run(conn, cmd) diff --git a/ceph_deploy/tests/unit/util/test_pkg_managers.py b/ceph_deploy/tests/unit/util/test_pkg_managers.py index 5ef7027..f4ebb02 100644 --- a/ceph_deploy/tests/unit/util/test_pkg_managers.py +++ b/ceph_deploy/tests/unit/util/test_pkg_managers.py @@ -5,7 +5,7 @@ from ceph_deploy.util import pkg_managers class TestRPM(object): def setup(self): - self.to_patch = 'ceph_deploy.util.pkg_managers.process.run' + self.to_patch = 'ceph_deploy.util.pkg_managers.remoto.process.run' def test_normal_flags(self): fake_run = Mock() @@ -27,7 +27,7 @@ class TestRPM(object): class TestApt(object): def setup(self): - self.to_patch = 'ceph_deploy.util.pkg_managers.process.run' + self.to_patch = 'ceph_deploy.util.pkg_managers.remoto.process.run' def test_install_single_package(self): fake_run = Mock() @@ -65,7 +65,7 @@ class TestApt(object): class TestYum(object): def setup(self): - self.to_patch = 'ceph_deploy.util.pkg_managers.process.run' + self.to_patch = 'ceph_deploy.util.pkg_managers.remoto.process.run' def test_install_single_package(self): fake_run = Mock() @@ -103,7 +103,7 @@ class TestYum(object): class TestZypper(object): def setup(self): - self.to_patch = 'ceph_deploy.util.pkg_managers.process.run' + self.to_patch = 'ceph_deploy.util.pkg_managers.remoto.process.run' def test_install_single_package(self): fake_run = Mock() diff --git a/ceph_deploy/util/pkg_managers.py b/ceph_deploy/util/pkg_managers.py index b0a598d..8985112 100644 --- a/ceph_deploy/util/pkg_managers.py +++ b/ceph_deploy/util/pkg_managers.py @@ -1,4 +1,4 @@ -from ceph_deploy.lib.remoto import process +from ceph_deploy.lib import remoto def apt(conn, packages, *a, **kw): @@ -12,7 +12,7 @@ def apt(conn, packages, *a, **kw): '--assume-yes', ] cmd.extend(packages) - return process.run( + return remoto.process.run( conn, cmd, *a, @@ -37,7 +37,7 @@ def apt_remove(conn, packages, *a, **kw): cmd.append('--purge') cmd.extend(packages) - return process.run( + return remoto.process.run( conn, cmd, *a, @@ -51,7 +51,7 @@ def apt_update(conn): '-q', 'update', ] - return process.run( + return remoto.process.run( conn, cmd, ) @@ -67,7 +67,7 @@ def yum(conn, packages, *a, **kw): 'install', ] cmd.extend(packages) - return process.run( + return remoto.process.run( conn, cmd, *a, @@ -86,7 +86,7 @@ def yum_remove(conn, packages, *a, **kw): cmd.append(packages) else: cmd.extend(packages) - return process.run( + return remoto.process.run( conn, cmd, *a, @@ -102,7 +102,7 @@ def yum_clean(conn, item=None): item, ] - return process.run( + return remoto.process.run( conn, cmd, ) @@ -119,7 +119,7 @@ def rpm(conn, rpm_args=None, *a, **kw): '-Uvh', ] cmd.extend(rpm_args) - return process.run( + return remoto.process.run( conn, cmd, *a, @@ -138,7 +138,7 @@ def zypper(conn, packages, *a, **kw): ] cmd.extend(packages) - return process.run( + return remoto.process.run( conn, cmd, *a, @@ -158,7 +158,7 @@ def zypper_remove(conn, packages, *a, **kw): cmd.append(packages) else: cmd.extend(packages) - return process.run( + return remoto.process.run( conn, cmd, *a, diff --git a/ceph_deploy/util/ssh.py b/ceph_deploy/util/ssh.py index 3d38998..1478a04 100644 --- a/ceph_deploy/util/ssh.py +++ b/ceph_deploy/util/ssh.py @@ -1,6 +1,5 @@ import logging -from ceph_deploy.lib.remoto import process -from ceph_deploy.lib.remoto.connection import needs_ssh +from ceph_deploy.lib import remoto from ceph_deploy.connection import get_local_connection @@ -13,14 +12,14 @@ def can_connect_passwordless(hostname): denied`` message. """ # Ensure we are not doing this for local hosts - if not needs_ssh(hostname): + if not remoto.connection.needs_ssh(hostname): return True logger = logging.getLogger(hostname) with get_local_connection(logger) as conn: # Check to see if we can login, disabling password prompts command = ['ssh', '-CT', '-o', 'BatchMode=yes', hostname] - out, err, retval = process.check(conn, command, stop_on_error=False) + out, err, retval = remoto.process.check(conn, command, stop_on_error=False) expected_error = 'Permission denied ' has_key_error = False for line in err: