Fix batch install using pkgng

For fully automated batch installing in FreeBSD you need to pass BATCH=true.
This commit is contained in:
Felipe Zipitria 2018-07-24 09:25:30 +01:00 committed by rallytime
parent e79ccb35b1
commit 0503bc18b6
No known key found for this signature in database
GPG Key ID: E8F1A4B90D0DEA19

View File

@ -794,7 +794,16 @@ def install(name=None,
.. code-block:: bash
salt '*' pkg.install <extended regular expression> pcre=True
batch
Use BATCH=true for pkg install, skipping all questions.
Be careful when using in production.
CLI Example:
.. code-block:: bash
salt '*' pkg.install <package name> batch=True
'''
try:
pkg_params, pkg_type = __salt__['pkg_resource.parse_targets'](
@ -806,6 +815,7 @@ def install(name=None,
if pkg_params is None or len(pkg_params) == 0:
return {}
env = {}
opts = 'y'
if salt.utils.is_true(orphan):
opts += 'A'
@ -825,6 +835,11 @@ def install(name=None,
opts += 'x'
if salt.utils.is_true(pcre):
opts += 'X'
if salt.utils.data.is_true(batch):
env = {
"BATCH": "true",
"ASSUME_ALWAYS_YES": "YES"
}
old = list_pkgs(jail=jail, chroot=chroot, root=root)
@ -861,7 +876,8 @@ def install(name=None,
out = __salt__['cmd.run_all'](
cmd,
output_loglevel='trace',
python_shell=False
python_shell=False,
env=env
)
if out['retcode'] != 0 and out['stderr']: