Fixing sudo user issue with virtual environments.
Change-Id: I828a17e6675c21a8eab0fc4f2afbd70487a5f83f
This commit is contained in:
parent
0eee778f35
commit
c640e32a4d
14
setup.py
14
setup.py
@ -70,6 +70,8 @@ setup(
|
||||
#'Programming Language :: Python :: 3.3',
|
||||
)
|
||||
)
|
||||
# real_prefix should only be set under a virtualenv
|
||||
using_virtualenv = hasattr(sys, 'real_prefix')
|
||||
|
||||
''' @todo: need to clean this up or do it with puppet/chef '''
|
||||
# Default Config Options
|
||||
@ -108,10 +110,14 @@ else:
|
||||
|
||||
# Get uid and gid of the current user to set permissions (Linux/OSX only)
|
||||
if platform.system().lower() != 'windows':
|
||||
sudo_user = os.getenv("SUDO_USER")
|
||||
uid = pwd.getpwnam(sudo_user).pw_uid
|
||||
gid = pwd.getpwnam(sudo_user).pw_gid
|
||||
|
||||
if using_virtualenv:
|
||||
working_user = os.getenv("USER")
|
||||
else:
|
||||
working_user = os.getenv("SUDO_USER")
|
||||
|
||||
uid = pwd.getpwnam(working_user).pw_uid
|
||||
gid = pwd.getpwnam(working_user).pw_gid
|
||||
|
||||
config_dirs = os.listdir("configs")
|
||||
for dir in config_dirs:
|
||||
if not os.path.exists("{0}/{1}".format(config_dir, dir)):
|
||||
|
Loading…
x
Reference in New Issue
Block a user