Check for file existance before blindly spawning them. Also, remove exit if spawn...
authorFaiyaz Ahmed <faiyaza@cs.princeton.edu>
Thu, 8 May 2008 21:12:56 +0000 (21:12 +0000)
committerFaiyaz Ahmed <faiyaza@cs.princeton.edu>
Thu, 8 May 2008 21:12:56 +0000 (21:12 +0000)
python/vserver.py

index 33c1952..e638149 100644 (file)
@@ -435,16 +435,16 @@ class VServer:
                 # XXX - we don't support all scripts that vserver script does
                 self.__do_chcontext(state_file)
                 for cmd in self.INITSCRIPTS:
-                     try:
-                         # enter vserver context
-                         arg_subst = { 'runlevel': runlevel }
-                         cmd_args = [cmd[0]] + map(lambda x: x % arg_subst,
+                    try:
+                        # enter vserver context
+                        arg_subst = { 'runlevel': runlevel }
+                        cmd_args = [cmd[0]] + map(lambda x: x % arg_subst,
                                                    cmd[1:])
-                         print >>log, "executing '%s'" % " ".join(cmd_args)
-                         os.spawnvp(os.P_NOWAIT,cmd[0],cmd_args)
-                     except:
-                         print >>log, traceback.format_exc()
-                         os._exit(1)
+                        if os.path.isfile(cmd[0]):                         
+                            print >>log, "executing '%s'" % " ".join(cmd_args)
+                            os.spawnvp(os.P_NOWAIT,cmd[0],cmd_args)
+                    except:
+                        print >>log, traceback.format_exc()
 
             # we get here due to an exception in the top-level child process
             except Exception, ex: