1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2024-09-14 20:13:21 +02:00

Suppressed output and updated documentation

This commit is contained in:
mujahideen 2013-03-30 11:57:53 -06:00
parent b70c26dc45
commit 6d5852529b

View file

@ -30,17 +30,17 @@ version_added: "1.0"
options: options:
name: name:
description: description:
- name of package to install/remove - name of package to install, upgrade or remove.
required: true required: true
state: state:
description: description:
- state of the package installed or absent. - state of the package (installed or absent).
required: false required: false
update_cache: update_cache:
description: description:
- update the package db first (pacman -Syy) - update the package database first (pacman -Syy).
required: false required: false
default: "no" default: "no"
choices: [ "yes", "no" ] choices: [ "yes", "no" ]
@ -55,7 +55,7 @@ examples:
- code: "pacman: name=foo,bar state=absent" - code: "pacman: name=foo,bar state=absent"
description: remove packages foo and bar description: remove packages foo and bar
- code: "pacman: name=bar, state=installed, update_cache=yes" - code: "pacman: name=bar, state=installed, update_cache=yes"
description: update the package db (pacman -Syy) then install bar (bar will be the updated if a newer version exists) description: update the package database (pacman -Syy) and install bar (bar will be the updated if a newer version exists)
''' '''
@ -81,7 +81,7 @@ def query_package(module, name, state="installed"):
def update_package_db(module): def update_package_db(module):
rc = os.system("pacman -Syy") rc = os.system("pacman -Syy > /dev/null")
if rc != 0: if rc != 0:
module.fail_json(msg="could not update package db") module.fail_json(msg="could not update package db")
@ -96,7 +96,7 @@ def remove_packages(module, packages):
if not query_package(module, package): if not query_package(module, package):
continue continue
rc = os.system("pacman -R %s --noconfirm" % (package)) rc = os.system("pacman -R %s --noconfirm > /dev/null" % (package))
if rc != 0: if rc != 0:
module.fail_json(msg="failed to remove %s" % (package)) module.fail_json(msg="failed to remove %s" % (package))
@ -118,7 +118,7 @@ def install_packages(module, packages):
if query_package(module, package): if query_package(module, package):
continue continue
rc = os.system("pacman -S %s --noconfirm" % (package)) rc = os.system("pacman -S %s --noconfirm > /dev/null" % (package))
if rc != 0: if rc != 0:
module.fail_json(msg="failed to install %s" % (package)) module.fail_json(msg="failed to install %s" % (package))