mirror of
https://github.com/ansible-collections/community.general.git
synced 2026-05-07 22:02:50 +00:00
[PR #11119/41923e43 backport][stable-12] fix ruff case SIM103 (#11132)
fix ruff case SIM103 (#11119)
* fix ruff case SIM103
* add changelog frag
(cherry picked from commit 41923e43bd)
Co-authored-by: Alexei Znamensky <103110+russoz@users.noreply.github.com>
This commit is contained in:
@@ -167,10 +167,7 @@ def query_package(module, name):
|
||||
# rpm -q returns 0 if the package is installed,
|
||||
# 1 if it is not installed
|
||||
rc, out, err = module.run_command([RPM_PATH, "-q", name])
|
||||
if rc == 0:
|
||||
return True
|
||||
else:
|
||||
return False
|
||||
return rc == 0
|
||||
|
||||
|
||||
def check_package_version(module, name):
|
||||
@@ -181,9 +178,7 @@ def check_package_version(module, name):
|
||||
rc, out, err = module.run_command([APT_CACHE, "policy", name], environ_update={"LANG": "C"})
|
||||
installed = re.split("\n |: ", out)[2]
|
||||
candidate = re.split("\n |: ", out)[4]
|
||||
if installed >= candidate:
|
||||
return True
|
||||
return False
|
||||
return installed >= candidate
|
||||
|
||||
|
||||
def query_package_provides(module, name, allow_upgrade=False):
|
||||
|
||||
Reference in New Issue
Block a user