Merge "Sync three-part RPC versions support from Oslo"

This commit is contained in:
Jenkins 2013-10-09 19:02:28 +00:00 committed by Gerrit Code Review
commit bd8ab18b6d

View File

@ -449,10 +449,22 @@ def version_is_compatible(imp_version, version):
"""
version_parts = version.split('.')
imp_version_parts = imp_version.split('.')
try:
rev = version_parts[2]
except IndexError:
rev = 0
try:
imp_rev = imp_version_parts[2]
except IndexError:
imp_rev = 0
if int(version_parts[0]) != int(imp_version_parts[0]): # Major
return False
if int(version_parts[1]) > int(imp_version_parts[1]): # Minor
return False
if (int(version_parts[1]) == int(imp_version_parts[1]) and
int(rev) > int(imp_rev)): # Revision
return False
return True