Fixing ns-3 DCE tests
[nepi.git] / src / nepi / resources / linux / application.py
index 9da05af..86cf9c9 100644 (file)
@@ -282,10 +282,11 @@ class LinuxApplication(ResourceManager):
             procs = dict()
             ps_aux = "ps aux |awk '{print $2,$11}'"
             (out, err), proc = self.node.execute(ps_aux)
-            for line in out.strip().split("\n"):
-                parts = line.strip().split(" ")
-                procs[parts[0]] = parts[1]
-            pickle.dump(procs, open("/tmp/save.proc", "wb"))
+            if len(out) != 0:
+                for line in out.strip().split("\n"):
+                    parts = line.strip().split(" ")
+                    procs[parts[0]] = parts[1]
+                pickle.dump(procs, open("/tmp/save.proc", "wb"))
             
         # create run dir for application
         self.node.mkdir(self.run_home)
@@ -359,6 +360,13 @@ class LinuxApplication(ResourceManager):
 
     def execute_deploy_command(self, command, prefix="deploy"):
         if command:
+            # replace application specific paths in the command
+            command = self.replace_paths(command)
+            
+            # replace application specific paths in the environment
+            env = self.get("env")
+            env = env and self.replace_paths(env)
+
             # Upload the command to a bash script and run it
             # in background ( but wait until the command has
             # finished to continue )
@@ -637,11 +645,15 @@ class LinuxApplication(ResourceManager):
     def do_release(self):
         self.info("Releasing resource")
 
+        self.do_stop()
+        
         tear_down = self.get("tearDown")
         if tear_down:
             self.node.execute(tear_down)
 
-        self.do_stop()
+        hard_release = self.get("hardRelease")
+        if hard_release:
+            self.node.rmdir(self.app_home)
 
         super(LinuxApplication, self).do_release()