X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=src%2Fnepi%2Fresources%2Flinux%2Ftap.py;h=24efdff5cfadb5b50288ccb269bef2168a51de6f;hb=81eb8370f0689f59aec1c356dae6fed95c9cce68;hp=7390dfb516363f164639b63b74ade6f41817e941;hpb=afadbc0a4f73d0f53c57bd93767714c12f0c6a5e;p=nepi.git diff --git a/src/nepi/resources/linux/tap.py b/src/nepi/resources/linux/tap.py index 7390dfb5..24efdff5 100644 --- a/src/nepi/resources/linux/tap.py +++ b/src/nepi/resources/linux/tap.py @@ -211,7 +211,45 @@ class LinuxTap(LinuxApplication): super(LinuxTap, self).do_release() - def gre_connect_command(self, remote_endpoint, connection_run_home): + def gre_connect(self, remote_endpoint, connection_app_home, + connection_run_home): + gre_connect_command = self._gre_connect_command( + remote_endpoint, connection_run_home) + + # upload command to connect.sh script + shfile = os.path.join(connection_app_home, "gre-connect.sh") + endpoint.node.upload(gre_connect_command, + shfile, + text = True, + overwrite = False) + + # invoke connect script + cmd = "bash %s" % shfile + (out, err), proc = self.node.run(cmd, connection_run_home) + + # check if execution errors occurred + msg = " Failed to connect endpoints " + + if proc.poll() or err: + self.error(msg, out, err) + raise RuntimeError, msg + + # Wait for pid file to be generated + pid, ppid = self.node.wait_pid(connection_run_home) + + # If the process is not running, check for error information + # on the remote machine + if not pid or not ppid: + (out, err), proc = self.node.check_errors(connection_run_home) + # Out is what was written in the stderr file + if err: + msg = " Failed to start command '%s' " % command + self.error(msg, out, err) + raise RuntimeError, msg + + return True + + def _gre_connect_command(self, remote_endpoint, connection_run_home): # Set the remote endpoint self.set("pointopoint", remote_endpoint.get("ip4")) self.set("greRemote", socket.gethostbyname(