Merge pull request #27379 from jfindlay/pip_vars

document and check dict type for pip env_vars
This commit is contained in:
Colton Myers 2015-09-29 20:56:52 -06:00
commit 989733ea86
2 changed files with 26 additions and 6 deletions

View File

@ -435,14 +435,20 @@ def install(pkgs=None, # pylint: disable=R0912,R0913,R0914
process_dependency_links process_dependency_links
Enable the processing of dependency links Enable the processing of dependency links
use_vt
Use VT terminal emulation (see ouptut while installing)
env_vars env_vars
Set environment variables that some builds will depend on. For example, Set environment variables that some builds will depend on. For example,
a Python C-module may have a Makefile that needs INCLUDE_PATH set to a Python C-module may have a Makefile that needs INCLUDE_PATH set to
pick up a header file while compiling. pick up a header file while compiling. This must be in the form of a
dictionary or a mapping.
Example:
.. code-block:: bash
salt '*' pip.install django_app env_vars="{'CUSTOM_PATH': '/opt/django_app'}"
use_vt
Use VT terminal emulation (see ouptut while installing)
CLI Example: CLI Example:
@ -718,7 +724,10 @@ def install(pkgs=None, # pylint: disable=R0912,R0913,R0914
cmd.append('--process-dependency-links') cmd.append('--process-dependency-links')
if env_vars: if env_vars:
os.environ.update(env_vars) if isinstance(env_vars, dict):
os.environ.update(env_vars)
else:
raise CommandExecutionError('env_vars {0} is not a dictionary'.format(env_vars))
try: try:
cmd_kwargs = dict(cwd=cwd, saltenv=saltenv, use_vt=use_vt, runas=user) cmd_kwargs = dict(cwd=cwd, saltenv=saltenv, use_vt=use_vt, runas=user)

View File

@ -387,7 +387,18 @@ def installed(name,
env_vars env_vars
Add or modify environment variables. Useful for tweaking build steps, Add or modify environment variables. Useful for tweaking build steps,
such as specifying INCLUDE or LIBRARY paths in Makefiles, build scripts or such as specifying INCLUDE or LIBRARY paths in Makefiles, build scripts or
compiler calls. compiler calls. This must be in the form of a dictionary or a mapping.
Example:
.. code-block:: yaml
django:
pip.installed:
- name: django_app
- env_vars:
CUSTOM_PATH: /opt/django_app
VERBOSE: True
use_vt use_vt
Use VT terminal emulation (see ouptut while installing) Use VT terminal emulation (see ouptut while installing)