From 4b86ad446df5e895fded4101f6b238398ef675a3 Mon Sep 17 00:00:00 2001 From: Thomas NOEL Date: Fri, 31 Mar 2017 14:51:44 +0200 Subject: [PATCH] wscall: don't crash on invalid targets status (#15712) --- wcs/wf/wscall.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/wcs/wf/wscall.py b/wcs/wf/wscall.py index 9adc1514..a6906994 100644 --- a/wcs/wf/wscall.py +++ b/wcs/wf/wscall.py @@ -360,6 +360,9 @@ class WebserviceCallStatusItem(WorkflowStatusItem): return if action == ':stop': raise AbortActionException() + if not [x for x in self.parent.parent.possible_status if x.id == action]: + # FIXME get_publisher().notify_of_exception ou un truc dans le genre + raise AbortActionException() formdata.status = 'wf-%s' % action formdata.store() raise AbortActionException() @@ -371,7 +374,12 @@ class WebserviceCallStatusItem(WorkflowStatusItem): value = getattr(self, attribute) if value in (':pass', ':stop'): continue - targets.append(self.parent.parent.get_status(value)) + try: + targets.extend([x for x in self.parent.parent.possible_status if x.id == value]) + except IndexError: + get_publisher().get_app_logger().error( + 'reference to invalid status in workflow %s, status %s, item %s' % ( + self.parent.parent.name, self.parent.name, self.description)) return targets def get_jump_label(self): -- 2.11.0