summaryrefslogtreecommitdiffstats
path: root/ansible_collections/community/general/plugins/modules/installp.py
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-06-05 16:18:41 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-06-05 16:18:41 +0000
commitb643c52cf29ce5bbab738b43290af3556efa1ca9 (patch)
tree21d5c53d7a9b696627a255777cefdf6f78968824 /ansible_collections/community/general/plugins/modules/installp.py
parentReleasing progress-linux version 9.5.1+dfsg-1~progress7.99u1. (diff)
downloadansible-b643c52cf29ce5bbab738b43290af3556efa1ca9.tar.xz
ansible-b643c52cf29ce5bbab738b43290af3556efa1ca9.zip
Merging upstream version 10.0.0+dfsg.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'ansible_collections/community/general/plugins/modules/installp.py')
-rw-r--r--ansible_collections/community/general/plugins/modules/installp.py13
1 files changed, 7 insertions, 6 deletions
diff --git a/ansible_collections/community/general/plugins/modules/installp.py b/ansible_collections/community/general/plugins/modules/installp.py
index 4b5a6949c..1531d2cad 100644
--- a/ansible_collections/community/general/plugins/modules/installp.py
+++ b/ansible_collections/community/general/plugins/modules/installp.py
@@ -106,7 +106,7 @@ def _check_new_pkg(module, package, repository_path):
if os.path.isdir(repository_path):
installp_cmd = module.get_bin_path('installp', True)
- rc, package_result, err = module.run_command("%s -l -MR -d %s" % (installp_cmd, repository_path))
+ rc, package_result, err = module.run_command([installp_cmd, "-l", "-MR", "-d", repository_path])
if rc != 0:
module.fail_json(msg="Failed to run installp.", rc=rc, err=err)
@@ -142,7 +142,7 @@ def _check_installed_pkg(module, package, repository_path):
"""
lslpp_cmd = module.get_bin_path('lslpp', True)
- rc, lslpp_result, err = module.run_command("%s -lcq %s*" % (lslpp_cmd, package))
+ rc, lslpp_result, err = module.run_command([lslpp_cmd, "-lcq", "%s*" % (package, )])
if rc == 1:
package_state = ' '.join(err.split()[-2:])
@@ -173,7 +173,7 @@ def remove(module, installp_cmd, packages):
if pkg_check:
if not module.check_mode:
- rc, remove_out, err = module.run_command("%s -u %s" % (installp_cmd, package))
+ rc, remove_out, err = module.run_command([installp_cmd, "-u", package])
if rc != 0:
module.fail_json(msg="Failed to run installp.", rc=rc, err=err)
remove_count += 1
@@ -202,8 +202,8 @@ def install(module, installp_cmd, packages, repository_path, accept_license):
already_installed_pkgs = {}
accept_license_param = {
- True: '-Y',
- False: '',
+ True: ['-Y'],
+ False: [],
}
# Validate if package exists on repository path.
@@ -230,7 +230,8 @@ def install(module, installp_cmd, packages, repository_path, accept_license):
else:
if not module.check_mode:
- rc, out, err = module.run_command("%s -a %s -X -d %s %s" % (installp_cmd, accept_license_param[accept_license], repository_path, package))
+ rc, out, err = module.run_command(
+ [installp_cmd, "-a"] + accept_license_param[accept_license] + ["-X", "-d", repository_path, package])
if rc != 0:
module.fail_json(msg="Failed to run installp", rc=rc, err=err)
installed_pkgs.append(package)