]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph-deploy.git/commitdiff
remove all the 'if' conditionals for install and use hosts.get
authorAlfredo Deza <alfredo@deza.pe>
Thu, 25 Jul 2013 15:26:10 +0000 (11:26 -0400)
committerAlfredo Deza <alfredo@deza.pe>
Thu, 25 Jul 2013 15:26:10 +0000 (11:26 -0400)
Signed-off-by: Alfredo Deza <alfredo@deza.pe>
ceph_deploy/install.py

index 1aad5d66dd4d3634df732f7a5908915945a30487..5843884783eacba5cb508e862fa17151d563d93a 100644 (file)
@@ -3,7 +3,7 @@ import logging
 from distutils.util import strtobool
 
 from . import exc
-from . import lsb
+from . import lsb, hosts
 from .cliutil import priority
 from .sudo_pushy import get_transport
 
@@ -369,6 +369,7 @@ def purge_data_any():
             'rm', '-rf', '--one-file-system', '--', '/etc/ceph',
             ])
 
+
 def install(args):
     version = getattr(args, args.version_kind)
     version_str = args.version_kind
@@ -380,35 +381,21 @@ def install(args):
         args.cluster,
         ' '.join(args.host),
         )
-
     for hostname in args.host:
-        LOG.debug('Detecting platform for host %s ...', hostname)
-
         # TODO username
-        sudo = args.pushy(get_transport(hostname))
-        (distro, release, codename) = lsb.get_lsb_release(sudo)
-        LOG.debug('Distro %s release %s codename %s', distro, release, codename)
-
-        if (distro == 'Debian' or distro == 'Ubuntu'):
-            install_r = sudo.compile(install_debian)
-        elif (distro == 'CentOS' or distro == 'Scientific') or distro.startswith('RedHat'):
-            install_r = sudo.compile(install_centos)
-        elif distro == 'Fedora':
-            install_r = sudo.compile(install_fedora)
-        elif (distro == 'SUSE LINUX'):
-            install_r = sudo.compile(install_suse)
-        else:
-            raise exc.UnsupportedPlatform(distro=distro, codename=codename)
-
-        LOG.debug('Installing on host %s ...', hostname)
-        install_r(
-            release=release,
-            codename=codename,
+        LOG.debug('Detecting platform for host %s ...', hostname)
+        distro = hosts.get(hostname)
+        LOG.info('Distro info: %s %s %s', distro.name, distro.release, distro.codename)
+        remote_install = distro.sudo_conn.compile(distro.install)
+        remote_install(
+            release=distro.release,
+            codename=distro.codename,
             version_kind=args.version_kind,
             version=version,
-            )
+        )
+
+        distro.sudo_conn.close()
 
-        sudo.close()
 
 def uninstall(args):
     LOG.debug(