mirror of
https://github.com/saltstack/salt.git
synced 2025-04-16 09:40:20 +00:00
Added ability to set environment variables in apt module
This commit is contained in:
parent
72b8322395
commit
17e35529d8
1 changed files with 10 additions and 0 deletions
|
@ -193,6 +193,10 @@ def install(name=None, refresh=False, fromrepo=None, skip_verify=False,
|
|||
if not fromrepo and repo:
|
||||
fromrepo = repo
|
||||
|
||||
if kwargs.get('env'):
|
||||
print kwargs.get('env')
|
||||
os.environ.update(kwargs.get('env'))
|
||||
|
||||
if pkg_params is None or len(pkg_params) == 0:
|
||||
return {}
|
||||
elif pkg_type == 'file':
|
||||
|
@ -237,6 +241,9 @@ def remove(pkg):
|
|||
ret_pkgs = []
|
||||
old_pkgs = list_pkgs()
|
||||
|
||||
if kwargs.get('env'):
|
||||
os.environ.update(kwargs.get('env'))
|
||||
|
||||
cmd = 'apt-get -q -y remove {0}'.format(pkg)
|
||||
__salt__['cmd.run'](cmd)
|
||||
new_pkgs = list_pkgs()
|
||||
|
@ -261,6 +268,9 @@ def purge(pkg):
|
|||
ret_pkgs = []
|
||||
old_pkgs = list_pkgs()
|
||||
|
||||
if kwargs.get('env'):
|
||||
os.environ.update(kwargs.get('env'))
|
||||
|
||||
# Remove inital package
|
||||
purge_cmd = 'apt-get -q -y purge {0}'.format(pkg)
|
||||
__salt__['cmd.run'](purge_cmd)
|
||||
|
|
Loading…
Add table
Reference in a new issue