]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph-deploy.git/commitdiff
fail earlier when platform is unsupported in a given host
authorAlfredo Deza <alfredo.deza@inktank.com>
Mon, 2 Dec 2013 22:01:17 +0000 (17:01 -0500)
committerAlfredo Deza <alfredo.deza@inktank.com>
Mon, 2 Dec 2013 22:01:17 +0000 (17:01 -0500)
Signed-off-by: Alfredo Deza <alfredo.deza@inktank.com>
ceph_deploy/hosts/__init__.py

index 98313f0864b2ab78b64d53960dc011a352073eb0..76bdf1491387d8aaa82f988b7362d26963720294 100644 (file)
@@ -36,8 +36,11 @@ def get(hostname, username=None, fallback=None):
     )
     conn.import_module(remotes)
     distro_name, release, codename = conn.remote_module.platform_information()
-    if not codename:
-        raise exc.UnsupportedPlatform(distro=distro_name, codename=codename)
+    if not codename or not _get_distro(distro_name):
+        raise exc.UnsupportedPlatform(
+            distro=distro_name,
+            codename=codename,
+            release=release)
 
     machine_type = conn.remote_module.machine_type()
 
@@ -53,6 +56,9 @@ def get(hostname, username=None, fallback=None):
 
 
 def _get_distro(distro, fallback=None):
+    if not distro:
+        return
+
     distro = _normalized_distro_name(distro)
     distributions = {
         'debian': debian,
@@ -63,12 +69,8 @@ def _get_distro(distro, fallback=None):
         'fedora': fedora,
         'suse': suse,
         }
-    try:
-        return distributions[distro]
-    except KeyError:
-        if fallback:
-            return _get_distro(fallback)
-        raise exc.UnsupportedPlatform(distro=distro, codename='')
+
+    return distributions.get(distro) or _get_distro(fallback)
 
 
 def _normalized_distro_name(distro):