From: Alfredo Deza Date: Thu, 17 Oct 2013 13:09:41 +0000 (-0400) Subject: ensure we can detect RedHat with whitespace too X-Git-Tag: v1.3~15^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=4f9aae9d4e5df1540c07a25d71e30b2802c620e7;p=ceph-deploy.git ensure we can detect RedHat with whitespace too Signed-off-by: Alfredo Deza --- diff --git a/ceph_deploy/hosts/__init__.py b/ceph_deploy/hosts/__init__.py index 470956c..9b19c7b 100644 --- a/ceph_deploy/hosts/__init__.py +++ b/ceph_deploy/hosts/__init__.py @@ -66,7 +66,7 @@ def _get_distro(distro, fallback=None): def _normalized_distro_name(distro): distro = distro.lower() - if distro.startswith('redhat'): + if distro.startswith(('redhat', 'red hat')): return 'redhat' elif distro.startswith('suse'): return 'suse' diff --git a/ceph_deploy/tests/unit/hosts/test_hosts.py b/ceph_deploy/tests/unit/hosts/test_hosts.py index ac087c0..4f6d805 100644 --- a/ceph_deploy/tests/unit/hosts/test_hosts.py +++ b/ceph_deploy/tests/unit/hosts/test_hosts.py @@ -46,6 +46,10 @@ class TestGetDistro(object): result = hosts._get_distro('RedHat') assert result.__name__.endswith('centos') + def test_get_redhat_whitespace(self): + result = hosts._get_distro('Red Hat Enterprise Linux') + assert result.__name__.endswith('centos') + def test_get_uknown(self): with raises(exc.UnsupportedPlatform): hosts._get_distro('Solaris')