From 4f9aae9d4e5df1540c07a25d71e30b2802c620e7 Mon Sep 17 00:00:00 2001 From: Alfredo Deza Date: Thu, 17 Oct 2013 09:09:41 -0400 Subject: [PATCH] ensure we can detect RedHat with whitespace too Signed-off-by: Alfredo Deza --- ceph_deploy/hosts/__init__.py | 2 +- ceph_deploy/tests/unit/hosts/test_hosts.py | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) 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') -- 2.47.3