merged ex_shutdown into nepi-3-dev
authorAlina Quereilhac <alina.quereilhac@inria.fr>
Mon, 28 Oct 2013 22:43:41 +0000 (23:43 +0100)
committerAlina Quereilhac <alina.quereilhac@inria.fr>
Mon, 28 Oct 2013 22:43:41 +0000 (23:43 +0100)
1  2 
src/nepi/resources/linux/node.py
src/nepi/resources/omf/application.py
src/nepi/resources/omf/interface.py
src/nepi/resources/omf/node.py
src/nepi/resources/omf/omf_resource.py
src/nepi/resources/planetlab/node.py
test/resources/omf/vlc.py

Simple merge
@@@ -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):
      """
          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. 
Simple merge
@@@ -18,9 -18,9 +18,8 @@@
  # Author: Alina Quereilhac <alina.quereilhac@inria.fr>
  #         Julien Tribino <julien.tribino@inria.fr>
  
--
- 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()
  
  #         Lucia Guevgeozian <lucia.guevgeozian_odizzio@inria.fr>
  
  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
Simple merge
@@@ -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")