]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph-deploy.git/commitdiff
remove sudo_pushy
authorAlfredo Deza <alfredo.deza@inktank.com>
Mon, 14 Oct 2013 19:32:41 +0000 (15:32 -0400)
committerAlfredo Deza <alfredo.deza@inktank.com>
Tue, 15 Oct 2013 12:51:58 +0000 (08:51 -0400)
ceph_deploy/sudo_pushy.py [deleted file]

diff --git a/ceph_deploy/sudo_pushy.py b/ceph_deploy/sudo_pushy.py
deleted file mode 100644 (file)
index ef57c98..0000000
+++ /dev/null
@@ -1,74 +0,0 @@
-import getpass
-import logging
-import socket
-import pushy.transport.ssh
-import pushy.transport.local
-import subprocess
-
-from .misc import remote_shortname
-
-logger = logging.getLogger(__name__)
-
-
-class Local_Popen(pushy.transport.local.Popen):
-    def __init__(self, command, address, **kwargs):
-        pushy.transport.BaseTransport.__init__(self, address)
-
-        self.__proc = subprocess.Popen(command, stdin=subprocess.PIPE,
-                                       stdout=subprocess.PIPE,
-                                       stderr=subprocess.PIPE,
-                                       bufsize=65535)
-
-        self.stdout = self.__proc.stdout
-        self.stderr = self.__proc.stderr
-        self.stdin  = self.__proc.stdin
-
-    def close(self):
-        self.stdin.close()
-        self.__proc.wait()
-
-
-class SshSudoTransport(object):
-    @staticmethod
-    def Popen(command, *a, **kw):
-        command = ['sudo'] + command
-        return pushy.transport.ssh.Popen(command, *a, **kw)
-
-
-class LocalSudoTransport(object):
-    @staticmethod
-    def Popen(command, *a, **kw):
-        command = ['sudo'] + command
-        return Local_Popen(command, *a, **kw)
-
-
-def get_transport(hostname):
-    use_sudo = needs_sudo()
-    myhostname = remote_shortname(socket)
-    if hostname == myhostname:
-        if use_sudo:
-            logger.debug('will use a local connection with sudo')
-            return 'local+sudo:'
-        logger.debug('will use a local connection without sudo')
-        return 'local:'
-    else:
-        if use_sudo:
-            logger.debug('will use a remote connection with sudo')
-            return 'ssh+sudo:{hostname}'.format(hostname=hostname)
-        logger.debug('will use a remote connection without sudo')
-        return 'ssh:{hostname}'.format(hostname=hostname)
-
-
-def needs_sudo():
-    if getpass.getuser() == 'root':
-        return False
-    return True
-
-
-def patch():
-    """
-    Monkey patches pushy so it supports running via (passphraseless)
-    sudo on the remote host.
-    """
-    pushy.transports['ssh+sudo'] = SshSudoTransport
-    pushy.transports['local+sudo'] = LocalSudoTransport