mirror of
https://github.com/saltstack/salt.git
synced 2025-04-17 10:10:20 +00:00
parent
cb572f8c41
commit
8140c96949
1 changed files with 15 additions and 0 deletions
|
@ -119,6 +119,11 @@ def install(pkg=None,
|
|||
elif pkgs:
|
||||
cmd += ' "{0}"'.format('" "'.join(pkgs))
|
||||
|
||||
if runas:
|
||||
uid = salt.utils.get_uid(runas)
|
||||
if uid:
|
||||
env.update({'SUDO_UID': uid, 'SUDO_USER': ''})
|
||||
|
||||
result = __salt__['cmd.run_all'](cmd, python_shell=False, cwd=dir, runas=runas, env=env)
|
||||
|
||||
if result['retcode'] != 0:
|
||||
|
@ -183,6 +188,11 @@ def uninstall(pkg,
|
|||
|
||||
'''
|
||||
|
||||
if runas:
|
||||
uid = salt.utils.get_uid(runas)
|
||||
if uid:
|
||||
env.update({'SUDO_UID': uid, 'SUDO_USER': ''})
|
||||
|
||||
cmd = 'npm uninstall'
|
||||
|
||||
if dir is None:
|
||||
|
@ -235,6 +245,11 @@ def list_(pkg=None,
|
|||
|
||||
'''
|
||||
|
||||
if runas:
|
||||
uid = salt.utils.get_uid(runas)
|
||||
if uid:
|
||||
env.update({'SUDO_UID': uid, 'SUDO_USER': ''})
|
||||
|
||||
cmd = 'npm list --silent --json'
|
||||
|
||||
if dir is None:
|
||||
|
|
Loading…
Add table
Reference in a new issue