mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-07-19 03:10:22 -07:00
Convert some run_command() string args to lists (#8264)
* Convert some run_command() string args to lists. * Change run_command with pipe and shell to Python code. * Add changelog. * Simplify syntax. Co-authored-by: Alexei Znamensky <103110+russoz@users.noreply.github.com> --------- Co-authored-by: Alexei Znamensky <103110+russoz@users.noreply.github.com>
This commit is contained in:
parent
b48293ca31
commit
70adba8991
14 changed files with 144 additions and 144 deletions
|
@ -106,9 +106,8 @@ def remove_packages(module, slackpkg_path, packages):
|
|||
continue
|
||||
|
||||
if not module.check_mode:
|
||||
rc, out, err = module.run_command("%s -default_answer=y -batch=on \
|
||||
remove %s" % (slackpkg_path,
|
||||
package))
|
||||
rc, out, err = module.run_command(
|
||||
[slackpkg_path, "-default_answer=y", "-batch=on", "remove", package])
|
||||
|
||||
if not module.check_mode and query_package(module, slackpkg_path,
|
||||
package):
|
||||
|
@ -132,9 +131,8 @@ def install_packages(module, slackpkg_path, packages):
|
|||
continue
|
||||
|
||||
if not module.check_mode:
|
||||
rc, out, err = module.run_command("%s -default_answer=y -batch=on \
|
||||
install %s" % (slackpkg_path,
|
||||
package))
|
||||
rc, out, err = module.run_command(
|
||||
[slackpkg_path, "-default_answer=y", "-batch=on", "install", package])
|
||||
|
||||
if not module.check_mode and not query_package(module, slackpkg_path,
|
||||
package):
|
||||
|
@ -155,9 +153,8 @@ def upgrade_packages(module, slackpkg_path, packages):
|
|||
|
||||
for package in packages:
|
||||
if not module.check_mode:
|
||||
rc, out, err = module.run_command("%s -default_answer=y -batch=on \
|
||||
upgrade %s" % (slackpkg_path,
|
||||
package))
|
||||
rc, out, err = module.run_command(
|
||||
[slackpkg_path, "-default_answer=y", "-batch=on", "upgrade", package])
|
||||
|
||||
if not module.check_mode and not query_package(module, slackpkg_path,
|
||||
package):
|
||||
|
@ -174,7 +171,8 @@ def upgrade_packages(module, slackpkg_path, packages):
|
|||
|
||||
|
||||
def update_cache(module, slackpkg_path):
|
||||
rc, out, err = module.run_command("%s -batch=on update" % (slackpkg_path))
|
||||
rc, out, err = module.run_command(
|
||||
[slackpkg_path, "-batch=on", "update"])
|
||||
if rc != 0:
|
||||
module.fail_json(msg="Could not update package cache")
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue