mirror of
https://github.com/saltstack/salt.git
synced 2025-04-17 10:10:20 +00:00
Merge pull request #48896 from rallytime/bp-48730
Back-port #48730 to 2017.7
This commit is contained in:
commit
5f6a56f5dc
1 changed files with 19 additions and 2 deletions
|
@ -671,6 +671,7 @@ def install(name=None,
|
|||
reinstall_requires=False,
|
||||
regex=False,
|
||||
pcre=False,
|
||||
batch=False,
|
||||
**kwargs):
|
||||
'''
|
||||
Install package(s) from a repository
|
||||
|
@ -794,7 +795,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 +816,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 +836,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 +877,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…
Add table
Reference in a new issue