Fix formatting

This commit is contained in:
Derek Maciel 2016-08-03 14:44:37 -04:00 committed by rallytime
parent 64f93f8938
commit 7c15f5b20a

View file

@ -651,29 +651,28 @@ def version_cmp(ver1, ver2, ignore_epoch=False):
'more accurate version comparisons'
)
else:
else:
# If one EVR is missing a release but not the other and they
# otherwise would be equal, assume they are equal. This can
# happen if e.g. you are checking if a package version 3.2 is
# satisfied by a 3.2-1.
(ver1_e, ver1_v, ver1_r) = salt.utils.str_version_to_evr(ver1)
(ver2_e, ver2_v, ver2_r) = salt.utils.str_version_to_evr(ver2)
if not ver1_r or not ver2_r:
tmp_cmp = cmp_func((ver1_e, ver1_v, ''), (ver2_e, ver2_v, ''))
if tmp_cmp not in (-1, 0, 1):
raise CommandExecutionError(
'Comparison result \'{0}\' is invalid'.format(tmp_cmp)
)
if tmp_cmp == 0:
return 0
cmp_result = cmp_func((ver1_e, ver1_v, ver1_r),
(ver2_e, ver2_v, ver2_r))
if cmp_result not in (-1, 0, 1):
# If one EVR is missing a release but not the other and they
# otherwise would be equal, assume they are equal. This can
# happen if e.g. you are checking if a package version 3.2 is
# satisfied by a 3.2-1.
(ver1_e, ver1_v, ver1_r) = salt.utils.str_version_to_evr(ver1)
(ver2_e, ver2_v, ver2_r) = salt.utils.str_version_to_evr(ver2)
if not ver1_r or not ver2_r:
tmp_cmp = cmp_func((ver1_e, ver1_v, ''), (ver2_e, ver2_v, ''))
if tmp_cmp not in (-1, 0, 1):
raise CommandExecutionError(
'Comparison result \'{0}\' is invalid'.format(cmp_result)
'Comparison result \'{0}\' is invalid'.format(tmp_cmp)
)
return cmp_result
if tmp_cmp == 0:
return 0
cmp_result = cmp_func((ver1_e, ver1_v, ver1_r),
(ver2_e, ver2_v, ver2_r))
if cmp_result not in (-1, 0, 1):
raise CommandExecutionError(
'Comparison result \'{0}\' is invalid'.format(cmp_result)
)
return cmp_result
except Exception as exc:
log.warning(