]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph-deploy.git/commitdiff
Modified the system to handle subversion numbers in the release number. For instance...
authorTom Walsh <tom.walsh@expresshosting.net>
Fri, 8 Aug 2014 03:48:59 +0000 (22:48 -0500)
committerAlfredo Deza <alfredo.deza@inktank.com>
Fri, 8 Aug 2014 23:34:39 +0000 (19:34 -0400)
I have also added a test to look for and test this corner case.

ceph_deploy/hosts/centos/install.py
ceph_deploy/tests/unit/hosts/test_centos.py

index f3b598993c54e5649cfb6395e5636a1875437169..684e4df5b4c094d73ef2b10c6c3ee32f10575bbb 100644 (file)
@@ -1,5 +1,6 @@
 from ceph_deploy.util import pkg_managers, templates
 from ceph_deploy.lib import remoto
+import re
 
 
 def rpm_dist(distro):
@@ -254,7 +255,9 @@ def repo_install(distro, reponame, baseurl, gpgkey, **kw):
 
 def float_or_zero(value):
     try:
-        return float(value)
+        regex = re.compile(r"^[^.]*")
+        newvalue = re.search(regex, value).group(0)
+        return float(newvalue)
     except:
         return 0.0
 
index 312fc4fd83b240e91c53abeb895c391133c9ca4c..e09cceba45278070d11985e43b9dd277a98aa850 100644 (file)
@@ -84,6 +84,11 @@ class TestCentosVersionDetection(object):
         self.distro.release = '7.0'
         assert centos.rpm_dist(self.distro) == 'el7'
 
+    def test_rpm_dist_detects_centos_version_with_subversion(self):
+        self.distro.normalized_name = 'centos'
+        self.distro.release = '7.0.1406'
+        assert centos.rpm_dist(self.distro) == 'el7'
+
     def test_rpm_dist_fallsback_to_el6_scientific(self):
         self.distro.normalized_name = 'scientific'
         self.distro.release = '5'