mirror of
https://github.com/saltstack/salt.git
synced 2025-04-17 10:10:20 +00:00
Fix formatting
This commit is contained in:
parent
64f93f8938
commit
7c15f5b20a
1 changed files with 20 additions and 21 deletions
|
@ -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(
|
||||
|
|
Loading…
Add table
Reference in a new issue