mirror of
https://github.com/valitydev/salt.git
synced 2024-11-08 01:18:58 +00:00
Fix batch install using pkgng
For fully automated batch installing in FreeBSD you need to pass BATCH=true.
This commit is contained in:
parent
e79ccb35b1
commit
0503bc18b6
@ -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']:
|
||||
|
Loading…
Reference in New Issue
Block a user