Commit dca7b7aa authored by Antoine Catton's avatar Antoine Catton

Minor: bugfix on promises.

parent ae02e2d6
...@@ -446,18 +446,19 @@ class Slapgrid(object): ...@@ -446,18 +446,19 @@ class Slapgrid(object):
# Check whether every promise is kept # Check whether every promise is kept
for promise in promises_list: for promise in promises_list:
command = os.path.join(promise_dir, promise) command = [os.path.join(promise_dir, promise)]
promise = os.path.basename(command[0])
kw = dict(stdout=subprocess.PIPE, stderr=subprocess.PIPE) kw = dict(stdout=subprocess.PIPE, stderr=subprocess.PIPE)
process_handler = SlapPopen(command, process_handler = SlapPopen(command,
preexec_fn=lambda: dropPrivileges(uid, gid), preexec_fn=lambda: dropPrivileges(uid, gid),
cwd=cwd, cwd=cwd,
env=None, **kw) env={}, **kw)
time.sleep(self.promise_timeout) time.sleep(self.promise_timeout)
promise = os.path.basename(command)
if process_handler.poll() is None: if process_handler.poll() is None:
process_handler.kill() process_handler.kill()
...@@ -466,8 +467,13 @@ class Slapgrid(object): ...@@ -466,8 +467,13 @@ class Slapgrid(object):
stderr = process_handler.communicate()[1] stderr = process_handler.communicate()[1]
if stderr is None: if stderr is None:
stderr = 'No error output from %r.' % promise stderr = 'No error output from %r.' % promise
else:
stderr = 'Promise %r:' % promise + stderr
raise Slapgrid.PromiseError(stderr) raise Slapgrid.PromiseError(stderr)
if not promise_present:
self.logger.info("No promise.")
def processComputerPartitionList(self): def processComputerPartitionList(self):
"""Will start supervisord and process each Computer Partition. """Will start supervisord and process each Computer Partition.
......
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