]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph-deploy.git/commitdiff
ensure we can detect RedHat with whitespace too 106/head
authorAlfredo Deza <alfredo.deza@inktank.com>
Thu, 17 Oct 2013 13:09:41 +0000 (09:09 -0400)
committerAlfredo Deza <alfredo.deza@inktank.com>
Thu, 17 Oct 2013 13:09:41 +0000 (09:09 -0400)
Signed-off-by: Alfredo Deza <alfredo.deza@inktank.com>
ceph_deploy/hosts/__init__.py
ceph_deploy/tests/unit/hosts/test_hosts.py

index 470956c65918069b43b354e61897e76d1aee161e..9b19c7b318894db97768cdeb0d55c0b9905c310e 100644 (file)
@@ -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'
index ac087c04466fcf745d72c52d58fe2509bbfd3124..4f6d805aa65bf4b5897f8c2bc3f237dc70dcfafe 100644 (file)
@@ -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')