Commit 88e050d6 authored by Łukasz Nowak's avatar Łukasz Nowak

Allow to pass specific slapproxy log file.

parent f200c1f8
...@@ -32,15 +32,21 @@ import xml_marshaller ...@@ -32,15 +32,21 @@ import xml_marshaller
class SlapOSControler(object): class SlapOSControler(object):
def __init__(self, config, log, process_group_pid_set=None): def __init__(self, config, log, process_group_pid_set=None,
slapproxy_log=None):
self.log = log self.log = log
self.config = config self.config = config
# By erasing everything, we make sure that we are able to "update" # By erasing everything, we make sure that we are able to "update"
# existing profiles. This is quite dirty way to do updates... # existing profiles. This is quite dirty way to do updates...
if os.path.exists(config['proxy_database']): if os.path.exists(config['proxy_database']):
os.unlink(config['proxy_database']) os.unlink(config['proxy_database'])
kwargs = dict(close_fds=True, preexec_fn=os.setsid)
if slapproxy_log is not None:
slapproxy_log_fp = open(slapproxy_log, 'w')
kwargs['stdout'] = slapproxy_log_fp
kwargs['stderr'] = slapproxy_log_fp
proxy = subprocess.Popen([config['slapproxy_binary'], proxy = subprocess.Popen([config['slapproxy_binary'],
config['slapos_config']], close_fds=True, preexec_fn=os.setsid) config['slapos_config']], **kwargs)
process_group_pid_set.add(proxy.pid) process_group_pid_set.add(proxy.pid)
# XXX: dirty, giving some time for proxy to being able to accept # XXX: dirty, giving some time for proxy to being able to accept
# connections # connections
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment