From 3b126e75d40948feceb65284b842e77e50fc1ae2 Mon Sep 17 00:00:00 2001 From: Alina Quereilhac Date: Sun, 21 Dec 2014 13:49:19 +0100 Subject: [PATCH] template_rm.py++ --- doc/templates/template_rm.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) 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 -- 2.43.0