From: Alina Quereilhac Date: Mon, 28 Oct 2013 22:43:41 +0000 (+0100) Subject: merged ex_shutdown into nepi-3-dev X-Git-Tag: nepi-3.0.0~26 X-Git-Url: http://git.onelab.eu/?a=commitdiff_plain;h=450b5dd0a993f63eb2ec34bbc656c558572eb44c;p=nepi.git merged ex_shutdown into nepi-3-dev --- 450b5dd0a993f63eb2ec34bbc656c558572eb44c diff --cc src/nepi/resources/omf/application.py index da8f64fa,54f88546..37d244cd --- a/src/nepi/resources/omf/application.py +++ b/src/nepi/resources/omf/application.py @@@ -25,7 -25,10 +25,6 @@@ from nepi.resources.omf.omf_resource im from nepi.resources.omf.node import OMFNode from nepi.resources.omf.omf_api import OMFAPIFactory -#from nepi.util.sshfuncs import ProcStatus -from nepi.util import sshfuncs - -- @clsinit_copy class OMFApplication(OMFResource): """ @@@ -152,11 -167,17 +151,11 @@@ if not self._omf_api : msg = "Credentials are not initialzed. XMPP Connections impossible" self.error(msg) - self.fail() - return + raise RuntimeError, msg - if self.get('sources'): - gateway = ResourceGateway.AMtoGateway[self.get('xmppHost')] - user = self.get('sshUser') or self.get('xmppSlice') - dst = user + "@"+ gateway + ":" - (out, err), proc = sshfuncs.rcopy(self.get('sources'), dst) - super(OMFApplication, self).deploy() + @failtrap def start(self): """ Start the RM. It means : Send Xmpp Message Using OMF protocol to execute the application. diff --cc src/nepi/resources/omf/node.py index 99bedf67,4da85d39..79c04f20 --- a/src/nepi/resources/omf/node.py +++ b/src/nepi/resources/omf/node.py @@@ -18,9 -18,9 +18,8 @@@ # Author: Alina Quereilhac # Julien Tribino -- - from nepi.execution.resource import ResourceManager, clsinit_copy, ResourceState, \ - reschedule_delay + from nepi.execution.resource import ResourceManager, clsinit_copy, \ + ResourceState, reschedule_delay, failtrap from nepi.execution.attribute import Attribute, Flags from nepi.resources.omf.omf_resource import ResourceGateway, OMFResource from nepi.resources.omf.omf_api import OMFAPIFactory @@@ -126,8 -124,7 +123,7 @@@ class OMFNode(OMFResource) except AttributeError: msg = "Credentials are not initialzed. XMPP Connections impossible" self.error(msg) - self.fail() - #raise AttributeError, msg - raise ++ raise super(OMFNode, self).deploy() diff --cc src/nepi/resources/omf/omf_resource.py index ddd4ad7e,632d201e..f1bb40cc --- a/src/nepi/resources/omf/omf_resource.py +++ b/src/nepi/resources/omf/omf_resource.py @@@ -19,21 -19,26 +19,31 @@@ # Lucia Guevgeozian from nepi.execution.attribute import Attribute, Flags, Types - from nepi.execution.resource import ResourceManager, clsinit, ResourceState, \ - reschedule_delay + from nepi.execution.resource import ResourceManager, clsinit_copy, \ + ResourceState, reschedule_delay + + class ResourceGateway: """ Dictionary used to set OMF gateway depending on Testbed information. """ ++ #XXX: A.Q. COMMENT: This looks a bit hardcoded ++ # SHOULDN'T THIS BE IN A SEPARATED FILE RATHER THAN IN THE ++ # BASE CLASS FOR ALL OMF RESOURCES? TestbedtoGateway = dict({ "wilabt" : "ops.wilab2.ilabt.iminds.be", "nitos" : "nitlab.inf.uth.gr", "nicta" : "??.??.??", + }) - @clsinit + AMtoGateway = dict({ + "am.wilab2.ilabt.iminds.be" : "ops.wilab2.ilabt.iminds.be", + "nitlab.inf.uth.gr" : "nitlab.inf.uth.gr", + "nicta" : "??.??.??", + }) + + @clsinit_copy class OMFResource(ResourceManager): """ Generic resource gathering XMPP credential information and common methods diff --cc test/resources/omf/vlc.py index a3053f57,eec6a8a6..1dd2a5f6 --- a/test/resources/omf/vlc.py +++ b/test/resources/omf/vlc.py @@@ -75,11 -74,7 +75,7 @@@ class OMFEachTestCase(unittest.TestCase self.ec.set(self.iface1, 'type', "g") self.ec.set(self.iface1, 'essid', "vlcexp") self.ec.set(self.iface1, 'ip', "10.0.0.17") - self.ec.set(self.iface1, 'xmppSlice', "nepi") - self.ec.set(self.iface1, 'xmppHost', "xmpp-plexus.onelab.eu") - self.ec.set(self.iface1, 'xmppPort', "5222") - self.ec.set(self.iface1, 'xmppPassword', "1234") - + self.channel = self.ec.register_resource("OMFChannel") self.ec.set(self.channel, 'channel', "6") self.ec.set(self.channel, 'xmppSlice', "nepi")