Make $BATCH=yes the default, remove module option
This commit is contained in:
parent
5664da4c63
commit
11a68b4cad
1 changed files with 5 additions and 15 deletions
|
@ -63,13 +63,6 @@ options:
|
||||||
for newer pkgng versions, specify a the name of a repository
|
for newer pkgng versions, specify a the name of a repository
|
||||||
configured in /usr/local/etc/pkg/repos
|
configured in /usr/local/etc/pkg/repos
|
||||||
required: false
|
required: false
|
||||||
batch:
|
|
||||||
description:
|
|
||||||
- for packages with interactive prompts during installation,
|
|
||||||
this makes pkgng automatically accept all default options for
|
|
||||||
the installation of the package.
|
|
||||||
default: yes
|
|
||||||
required: false
|
|
||||||
author: bleader
|
author: bleader
|
||||||
notes:
|
notes:
|
||||||
- When using pkgsite, be careful that already in cache packages won't be downloaded again.
|
- When using pkgsite, be careful that already in cache packages won't be downloaded again.
|
||||||
|
@ -143,7 +136,7 @@ def remove_packages(module, pkgng_path, packages):
|
||||||
return (False, "package(s) already absent")
|
return (False, "package(s) already absent")
|
||||||
|
|
||||||
|
|
||||||
def install_packages(module, pkgng_path, packages, cached, pkgsite, batch):
|
def install_packages(module, pkgng_path, packages, cached, pkgsite):
|
||||||
|
|
||||||
install_c = 0
|
install_c = 0
|
||||||
|
|
||||||
|
@ -156,10 +149,8 @@ def install_packages(module, pkgng_path, packages, cached, pkgsite, batch):
|
||||||
else:
|
else:
|
||||||
pkgsite = "-r %s" % (pkgsite)
|
pkgsite = "-r %s" % (pkgsite)
|
||||||
|
|
||||||
if batch == True:
|
batch_var = 'env BATCH=yes' # This environment variable skips mid-install prompts,
|
||||||
batch_var = 'env BATCH=yes'
|
# setting them to their default values.
|
||||||
else:
|
|
||||||
batch_var = ''
|
|
||||||
|
|
||||||
if not module.check_mode and not cached:
|
if not module.check_mode and not cached:
|
||||||
if old_pkgng:
|
if old_pkgng:
|
||||||
|
@ -276,8 +267,7 @@ def main():
|
||||||
name = dict(aliases=["pkg"], required=True),
|
name = dict(aliases=["pkg"], required=True),
|
||||||
cached = dict(default=False, type='bool'),
|
cached = dict(default=False, type='bool'),
|
||||||
annotation = dict(default="", required=False),
|
annotation = dict(default="", required=False),
|
||||||
pkgsite = dict(default="", required=False),
|
pkgsite = dict(default="", required=False)),
|
||||||
batch = dict(default=False, required=False, type='bool')),
|
|
||||||
supports_check_mode = True)
|
supports_check_mode = True)
|
||||||
|
|
||||||
pkgng_path = module.get_bin_path('pkg', True)
|
pkgng_path = module.get_bin_path('pkg', True)
|
||||||
|
@ -290,7 +280,7 @@ def main():
|
||||||
msgs = []
|
msgs = []
|
||||||
|
|
||||||
if p["state"] == "present":
|
if p["state"] == "present":
|
||||||
_changed, _msg = install_packages(module, pkgng_path, pkgs, p["cached"], p["pkgsite"], p["batch"])
|
_changed, _msg = install_packages(module, pkgng_path, pkgs, p["cached"], p["pkgsite"])
|
||||||
changed = changed or _changed
|
changed = changed or _changed
|
||||||
msgs.append(_msg)
|
msgs.append(_msg)
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue