Try byte literals rather than unicode strings in the env

This commit is contained in:
Ryan Lane 2015-06-25 15:21:37 -07:00
parent c8514de334
commit 6fde58182f

View file

@ -125,7 +125,7 @@ def install(pkg=None,
if runas:
uid = salt.utils.get_uid(runas)
if uid:
env.update({'SUDO_UID': uid, 'SUDO_USER': ''})
env.update({'SUDO_UID': b'{0}'.format(uid), 'SUDO_USER': b''})
result = __salt__['cmd.run_all'](cmd, python_shell=False, cwd=dir, runas=runas, env=env)
@ -197,7 +197,7 @@ def uninstall(pkg,
if runas:
uid = salt.utils.get_uid(runas)
if uid:
env.update({'SUDO_UID': uid, 'SUDO_USER': ''})
env.update({'SUDO_UID': b'{0}'.format(uid), 'SUDO_USER': b''})
cmd = 'npm uninstall'
@ -257,7 +257,7 @@ def list_(pkg=None,
if runas:
uid = salt.utils.get_uid(runas)
if uid:
env.update({'SUDO_UID': uid, 'SUDO_USER': ''})
env.update({'SUDO_UID': b'{0}'.format(uid), 'SUDO_USER': b''})
cmd = 'npm list --silent --json'