mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
pkgin: change install/remove to not use return code of pkgin
pkgin always returns 0 so can't be used to tell if the install or remove worked. Instead this just queries the installed packages after performing an operation.
This commit is contained in:
parent
4a9201ad65
commit
e34eaa423d
1 changed files with 2 additions and 2 deletions
|
@ -82,7 +82,7 @@ def remove_packages(module, packages):
|
||||||
|
|
||||||
rc = os.system("%s -y remove %s" % (PKGIN_PATH, package))
|
rc = os.system("%s -y remove %s" % (PKGIN_PATH, package))
|
||||||
|
|
||||||
if rc != 0:
|
if query_package(module, package):
|
||||||
module.fail_json(msg="failed to remove %s" % (package))
|
module.fail_json(msg="failed to remove %s" % (package))
|
||||||
|
|
||||||
remove_c += 1
|
remove_c += 1
|
||||||
|
@ -104,7 +104,7 @@ def install_packages(module, packages):
|
||||||
|
|
||||||
rc = os.system("%s -y install %s" % (PKGIN_PATH, package))
|
rc = os.system("%s -y install %s" % (PKGIN_PATH, package))
|
||||||
|
|
||||||
if rc != 0:
|
if not query_package(module, package):
|
||||||
module.fail_json(msg="failed to install %s" % (package))
|
module.fail_json(msg="failed to install %s" % (package))
|
||||||
|
|
||||||
install_c += 1
|
install_c += 1
|
||||||
|
|
Loading…
Reference in a new issue