applied the except and raise fixers to the master branch to close the gap with py3
[nepi.git] / src / nepi / resources / linux / tap.py
index be80ee0..ac11eb0 100644 (file)
@@ -3,9 +3,8 @@
 #    Copyright (C) 2013 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
@@ -108,7 +107,7 @@ class LinuxTap(LinuxApplication):
     def node(self):
         node = self.get_connected(LinuxNode.get_rtype())
         if node: return node[0]
-        raise RuntimeError, "linux::TAP/TUN devices must be connected to a linux::Node"
+        raise RuntimeError("linux::TAP/TUN devices must be connected to a linux::Node")
 
     @property
     def gre_enabled(self):
@@ -244,7 +243,7 @@ class LinuxTap(LinuxApplication):
         else:
             msg = " Failed to execute command '%s'" % command
             self.error(msg, out, err)
-            raise RuntimeError, msg
+            raise RuntimeError(msg)
 
     def do_stop(self):
         command = self.get('command') or ''
@@ -316,7 +315,7 @@ class LinuxTap(LinuxApplication):
         
         if proc.poll() or err:
             self.error(msg, out, err)
-            raise RuntimeError, msg
+            raise RuntimeError(msg)
     
         # Wait for pid file to be generated
         pid, ppid = self.node.wait_pid(connection_run_home, 
@@ -332,7 +331,7 @@ class LinuxTap(LinuxApplication):
             if err:
                 msg = " Failed to start command '%s' " % command
                 self.error(msg, out, err)
-                raise RuntimeError, msg
+                raise RuntimeError(msg)
         
         return True
 
@@ -367,7 +366,7 @@ class LinuxTap(LinuxApplication):
         
         if proc.poll():
             self.error(msg, out, err)
-            raise RuntimeError, msg
+            raise RuntimeError(msg)
     
         # Wait for pid file to be generated
         self._pid, self._ppid = self.node.wait_pid(
@@ -385,7 +384,7 @@ class LinuxTap(LinuxApplication):
             if err:
                 msg = " Failed to start command '%s' " % command
                 self.error(msg, out, err)
-                raise RuntimeError, msg
+                raise RuntimeError(msg)
 
         return self.wait_file(connection_run_home, "local_port")
 
@@ -413,7 +412,7 @@ class LinuxTap(LinuxApplication):
             if proc.poll() and err:
                 msg = " Failed to Kill the Tap"
                 self.error(msg, out, err)
-                raise RuntimeError, msg
+                raise RuntimeError(msg)
 
     def check_status(self):
         return self.node.status(self._pid, self._ppid)
@@ -434,7 +433,7 @@ class LinuxTap(LinuxApplication):
         else:
             msg = "Couldn't retrieve %s" % filename
             self.error(msg, out, err)
-            raise RuntimeError, msg
+            raise RuntimeError(msg)
 
         return result
 
@@ -493,7 +492,7 @@ class LinuxTap(LinuxApplication):
     def _start_gre_command(self):
         command = []
         command.append("sudo -S modprobe ip_gre")
-        command.append("sudo -S ip tunnel add %s mode gre remote %s local %s ttl 64 csum key %s" % (
+        command.append("sudo -S ip tunnel add %s mode gre remote %s local %s ttl 255 csum key %s" % (
                 self.get("deviceName"),
                 self.get("greRemote"),
                 self.node.get("ip"),