From: Alfredo Deza Date: Tue, 11 Aug 2015 18:19:40 +0000 (-0400) Subject: [RM-11115] use the new class for normalized versions X-Git-Tag: v1.5.28~4^2~4 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=740a83d11f35276aa85d0a11df5db2c96a3887a4;p=ceph-deploy.git [RM-11115] use the new class for normalized versions Signed-off-by: Alfredo Deza --- diff --git a/ceph_deploy/hosts/__init__.py b/ceph_deploy/hosts/__init__.py index 18ec547..17aa99e 100644 --- a/ceph_deploy/hosts/__init__.py +++ b/ceph_deploy/hosts/__init__.py @@ -6,6 +6,7 @@ on the type of distribution/version we are dealing with. """ import logging from ceph_deploy import exc +from ceph_deploy.util import versions from ceph_deploy.hosts import debian, centos, fedora, suse, remotes, rhel from ceph_deploy.connection import get_connection @@ -121,21 +122,6 @@ def _normalized_release(release): normalized_version.int_major """ - release = release.strip() - - class NormalizedVersion(object): - pass - v = NormalizedVersion() # fake object to get nice dotted access - v.major, v.minor, v.patch, v.garbage = (release.split('.') + ["0"]*4)[:4] - release_map = dict(major=v.major, minor=v.minor, patch=v.patch, garbage=v.garbage) - - # safe int versions that remove non-numerical chars - # for example 'rc1' in a version like '1-rc1 - for name, value in release_map.items(): - if '-' in value: # get rid of garbage like -dev1 or -rc1 - value = value.split('-')[0] - value = float(''.join(c for c in value if c.isdigit()) or 0) - int_name = "int_%s" % name - setattr(v, int_name, value) - - return v + # TODO: at some point deprecate this function so that we just + # use this class directly (and update every test that calls it + return versions.NormalizedVersion(release)