From: Stephan Conrad <stephan.conrad(a)gmail.com>
Signed-off-by: Stephan Conrad <stephan.conrad(a)gmail.com>
---
src/wok/proxy.py | 12 +++++++-----
1 file changed, 7 insertions(+), 5 deletions(-)
diff --git a/src/wok/proxy.py b/src/wok/proxy.py
index 10008da..574a3b3 100644
--- a/src/wok/proxy.py
+++ b/src/wok/proxy.py
@@ -47,11 +47,13 @@ def _create_proxy_config(options):
# User that will run the worker process of the proxy. Fedora,
# RHEL and Suse creates an user called 'nginx' when installing
# the proxy. Ubuntu creates an user 'www-data' for it.
- user_proxy = 'nginx'
- try:
- pwd.getpwnam(user_proxy)
- except KeyError:
- user_proxy = 'www-data'
+ user_proxy = None
+ user_list = ('nginx', 'www-data', 'http')
+ sys_users = [p.pw_name for p in pwd.getpwall()]
+ for user in user_list:
+ if user in sys_users:
+ user_proxy = user
+ break
config_dir = paths.conf_dir
nginx_config_dir = paths.nginx_conf_dir
--
2.6.2