]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph-deploy.git/commitdiff
Fine tuned the tests to catch some more corner cases.
authorTom Walsh <tom.walsh@expresshosting.net>
Fri, 8 Aug 2014 00:25:00 +0000 (19:25 -0500)
committerAlfredo Deza <alfredo.deza@inktank.com>
Fri, 8 Aug 2014 23:32:04 +0000 (19:32 -0400)
Adjusted the logic in install.py to match what was already there.

Signed-off-by: Tom Walsh <tom.walsh@expresshosting.net>
ceph_deploy/hosts/centos/install.py
ceph_deploy/tests/unit/hosts/test_centos.py

index 83c519bd8d1e430fbe9838f076583d557b086adb..277cfaaff7270f32d858f4d0781c43fc20c351d3 100644 (file)
@@ -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'
 
index 931e61665eebba9e7d80daef7b111f081d4d2f6b..378ae66cba6d56c7e2c6d06c176cedd92ed048a5 100644 (file)
@@ -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):