From: Alfredo Deza Date: Mon, 2 Dec 2013 22:01:17 +0000 (-0500) Subject: fail earlier when platform is unsupported in a given host X-Git-Tag: v1.3.4~5^2~1 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=82abc33e632cafbd365f2a3f63be9167cef02efe;p=ceph-deploy.git fail earlier when platform is unsupported in a given host Signed-off-by: Alfredo Deza --- diff --git a/ceph_deploy/hosts/__init__.py b/ceph_deploy/hosts/__init__.py index 98313f0..76bdf14 100644 --- a/ceph_deploy/hosts/__init__.py +++ b/ceph_deploy/hosts/__init__.py @@ -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):