From: Tom Walsh Date: Fri, 8 Aug 2014 00:25:00 +0000 (-0500) Subject: Fine tuned the tests to catch some more corner cases. X-Git-Tag: v1.5.11~11 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=31f928a892b62f40260a85ccda7ccc1b1fc0254e;p=ceph-deploy.git Fine tuned the tests to catch some more corner cases. Adjusted the logic in install.py to match what was already there. Signed-off-by: Tom Walsh --- diff --git a/ceph_deploy/hosts/centos/install.py b/ceph_deploy/hosts/centos/install.py index 83c519b..277cfaa 100644 --- a/ceph_deploy/hosts/centos/install.py +++ b/ceph_deploy/hosts/centos/install.py @@ -6,7 +6,7 @@ def rpm_dist(distro): # start using the el7 prefix now that rhel7 exists. if distro.normalized_name == 'redhat' and distro.release.startswith('7'): return 'el7' - elif distro.normalized_name == 'centos' and distro.release.startswith('7'): + if distro.normalized_name == 'centos' and distro.release.startswith('7'): return 'el7' return 'el6' @@ -34,6 +34,8 @@ def repository_url_part(distro): return 'rhel7' if distro.normalized_name == 'centos': + if distro.release.startswith('6'): + return 'el6' if distro.release.startswith('7'): return 'el7' diff --git a/ceph_deploy/tests/unit/hosts/test_centos.py b/ceph_deploy/tests/unit/hosts/test_centos.py index 931e616..378ae66 100644 --- a/ceph_deploy/tests/unit/hosts/test_centos.py +++ b/ceph_deploy/tests/unit/hosts/test_centos.py @@ -38,10 +38,10 @@ class TestCentosVersionDetection(object): self.distro.release = '7.0' assert centos.rpm_dist(self.distro) == 'el7' -""" - Adding specific tests here to detect more than just RedHat (CentOS) - - """ + def test_url_fallsback_to_el6_centos(self): + self.distro.normalized_name = 'centos' + self.distro.release = '' + assert centos.repository_url_part(self.distro) == 'el6' def test_url_detects_el5(self): self.distro.normalized_name = 'centos' @@ -50,6 +50,7 @@ class TestCentosVersionDetection(object): def test_url_detects_el6(self): self.distro.normalized_name = 'centos' + self.distro.release = '6.0' assert centos.repository_url_part(self.distro) == 'el6' def test_url_detects_el7(self):