Minor bugfixes on Linux CCN module
authorAlina Quereilhac <alina.quereilhac@inria.fr>
Sat, 13 Jul 2013 01:05:41 +0000 (18:05 -0700)
committerAlina Quereilhac <alina.quereilhac@inria.fr>
Sat, 13 Jul 2013 01:05:41 +0000 (18:05 -0700)
src/nepi/resources/linux/application.py
src/nepi/resources/linux/ccn/ccncontent.py
src/nepi/resources/linux/ccn/fibentry.py
src/nepi/resources/linux/mtr.py
src/nepi/resources/linux/ping.py
src/nepi/resources/linux/tcpdump.py

index 117392d..493c899 100644 (file)
@@ -435,7 +435,9 @@ class LinuxApplication(ResourceManager):
             self.node.upload(stdin, dst, overwrite = False, text = True)
 
             # create "stdin" symlink on ${APP_HOME} directory
-            command = "( cd %s ; ln -s %s stdin )" % ( self.app_home, dst)
+            command = "( cd %(app_home)s ; [ ! -f stdin ] &&  ln -s %(stdin)s stdin )" % ({
+                "app_home": self.app_home, 
+                "stdin": dst })
 
             return command
 
index febcefc..62bc55d 100644 (file)
@@ -100,6 +100,8 @@ class LinuxCCNContent(LinuxApplication):
         env = self.get("env")
 
         if command:
+            self.info("Uploading command '%s'" % command)
+
             # We want to make sure the content is published
             # before the experiment starts.
             # Run the command as a bash script in the background, 
@@ -108,7 +110,8 @@ class LinuxCCNContent(LinuxApplication):
             env = self.replace_paths(env)
             command = self.replace_paths(command)
 
-            (out, err), proc = self.execute_command(command, env)
+            (out, err), proc = self.execute_command(command, env, 
+                    blocking = True)
 
             if proc.poll():
                 self.fail()
index ace4f52..91e58de 100644 (file)
@@ -156,9 +156,8 @@ class LinuxFIBEntry(LinuxApplication):
             # force waiting until ping is READY before we starting the FIB
             self.ec.register_condition(self.guid, ResourceAction.START, 
                     self._ping, ResourceState.READY)
-            # schedule ping deploy and start
+            # schedule ping deploy
             self.ec.deploy(group=[self._ping])
-            self.ec.start_with_conditions(self._ping)
 
         if self.trace_enabled("mtr"):
             self.info("Configuring TRACE trace")
@@ -172,10 +171,8 @@ class LinuxFIBEntry(LinuxApplication):
             # force waiting until mtr is READY before we starting the FIB
             self.ec.register_condition(self.guid, ResourceAction.START, 
                     self._mtr, ResourceState.READY)
-            # schedule mtr deploy and start
+            # schedule mtr deploy
             self.ec.deploy(group=[self._mtr])
-            self.ec.start_with_conditions(self._mtr)
-
     
     def start(self):
         if self._state in [ResourceState.READY, ResourceState.STARTED]:
index 9de7ca1..85a9f25 100644 (file)
@@ -87,6 +87,9 @@ class LinuxMtr(LinuxApplication):
         if not self.get("command"):
             self.set("command", self._start_command)
 
+        if not self.get("env"):
+            self.set("env", "PATH=$PATH:/usr/sbin/")
+
         if not self.get("depends"):
             self.set("depends", "mtr")
 
index a80397b..10c396f 100644 (file)
@@ -193,6 +193,8 @@ class LinuxPing(LinuxApplication):
     def _start_command(self):
         args = []
 
+        args.append("echo 'Starting PING to %s' ;" % self.get("target"))
+
         if self.get("printTimestamp") == True:
             args.append("""echo "`date +'%Y%m%d%H%M%S'`";""")
 
index 06357de..3fa11f2 100644 (file)
@@ -320,6 +320,9 @@ class LinuxTcpdump(LinuxApplication):
         if not self.get("command"):
             self.set("command", self._start_command)
 
+        if not self.get("env"):
+            self.set("env", "PATH=$PATH:/usr/sbin/")
+
         if not self.get("depends"):
             self.set("depends", "tcpdump")