applied the except and raise fixers to the master branch to close the gap with py3
[nepi.git] / src / nepi / resources / linux / netns / netnsemulation.py
index 5d6aae4..904be9f 100644 (file)
@@ -3,9 +3,8 @@
 #    Copyright (C) 2014 INRIA
 #
 #    This program is free software: you can redistribute it and/or modify
-#    it under the terms of the GNU General Public License as published by
-#    the Free Software Foundation, either version 3 of the License, or
-#    (at your option) any later version.
+#    it under the terms of the GNU General Public License version 2 as
+#    published by the Free Software Foundation;
 #
 #    This program is distributed in the hope that it will be useful,
 #    but WITHOUT ANY WARRANTY; without even the implied warranty of
@@ -32,7 +31,7 @@ import threading
 
 @clsinit_copy
 class LinuxNetNSEmulation(LinuxApplication, NetNSEmulation):
-    _rtype = "LinuxNetNSEmulation"
+    _rtype = "linux::netns::Emulation"
 
     @classmethod
     def _register_attributes(cls):
@@ -174,6 +173,26 @@ class LinuxNetNSEmulation(LinuxApplication, NetNSEmulation):
 
             self.set_ready()
 
+    def do_start(self):
+        """ Starts  execution execution
+
+        """
+        self.info("Starting")
+
+        if self.state == ResourceState.READY:
+            self.set_started()
+        else:
+            msg = " Failed to execute command '%s'" % command
+            self.error(msg, out, err)
+            raise RuntimeError(msg)
+
+    def do_stop(self):
+        """ Stops simulation execution
+
+        """
+        if self.state == ResourceState.STARTED:
+            self.set_stopped()
+
     def do_release(self):
         self.info("Releasing resource")
 
@@ -208,9 +227,9 @@ class LinuxNetNSEmulation(LinuxApplication, NetNSEmulation):
     @property
     def _dependencies(self):
         if self.node.use_rpm:
-            return ( " python python-devel mercurial unzip bridge-utils iproute")
+            return (" python python-devel mercurial unzip bridge-utils iproute")
         elif self.node.use_deb:
-            return ( " python python-dev mercurial unzip bridge-utils iproute")
+            return (" python python-dev mercurial unzip bridge-utils iproute")
         return ""
 
     @property