From: Alina Quereilhac Date: Sun, 21 Dec 2014 12:49:19 +0000 (+0100) Subject: template_rm.py++ X-Git-Tag: nepi-3.2.0~31 X-Git-Url: http://git.onelab.eu/?p=nepi.git;a=commitdiff_plain;h=3b126e75d40948feceb65284b842e77e50fc1ae2 template_rm.py++ --- diff --git a/doc/templates/template_rm.py b/doc/templates/template_rm.py index 6eb02229..b37feb85 100644 --- a/doc/templates/template_rm.py +++ b/doc/templates/template_rm.py @@ -134,6 +134,12 @@ class RMClass(ResourceManager): if other_rm.state < ResourceState.READY: self.ec.schedule(self.reschedule_delay, self.deploy) + + elif other_rm.state == ResourceState.FAILED: + msg = "Failed to deploy resource" + self.error(msg) + raise RuntimeError(msg) + else: self.do_discover() self.do_provision() @@ -169,6 +175,13 @@ class RMClass(ResourceManager): def state(self): """ Returns the state of the RM. + + The state method should never raise an exception, instead if an + error occurs it should log the error and invoke the self.do_fail + method as follows: + + self.error(msg, out, err) + self.do_fail() """ return super(RMClass, self).state