Commit 9d251b8a authored by Jérome Perrin's avatar Jérome Perrin

standalone: drop into pdb when promise error in debug mode

maybe this is something slapos node instance should do instead ...
parent 2baa2125
...@@ -50,6 +50,7 @@ import psutil ...@@ -50,6 +50,7 @@ import psutil
from .interface.slap import IException from .interface.slap import IException
from .interface.slap import ISupply from .interface.slap import ISupply
from .interface.slap import IRequester from .interface.slap import IRequester
from ..grid.slapgrid import SLAPGRID_PROMISE_FAIL
from .slap import slap from .slap import slap
from ..grid.svcbackend import getSupervisorRPC from ..grid.svcbackend import getSupervisorRPC
...@@ -630,9 +631,14 @@ class StandaloneSlapOS(object): ...@@ -630,9 +631,14 @@ class StandaloneSlapOS(object):
prog = self._slapos_commands[command] prog = self._slapos_commands[command]
# used in format(**locals()) below # used in format(**locals()) below
debug_args = prog.get('debug_args', '') # pylint: disable=unused-variable debug_args = prog.get('debug_args', '') # pylint: disable=unused-variable
return subprocess.check_call( command = prog['command'].format(**locals())
prog['command'].format(**locals()), shell=True) try:
return subprocess.check_call(command, shell=True)
except subprocess.CalledProcessError as e:
if e.returncode == SLAPGRID_PROMISE_FAIL:
self._logger.exception('Promise error when running %s', command)
import pdb; pdb.post_mortem()
raise
with self.system_supervisor_rpc as supervisor: with self.system_supervisor_rpc as supervisor:
retry = 0 retry = 0
while True: while True:
......
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