I have also added a test to look for and test this corner case.
from ceph_deploy.util import pkg_managers, templates
from ceph_deploy.lib import remoto
+import re
def rpm_dist(distro):
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
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'