From: Faiyaz Ahmed Date: Thu, 8 May 2008 21:12:56 +0000 (+0000) Subject: Check for file existance before blindly spawning them. Also, remove exit if spawn... X-Git-Tag: util-vserver-pl-0.3-4~2 X-Git-Url: http://git.onelab.eu/?p=util-vserver-pl.git;a=commitdiff_plain;h=6d0cf1f215994c864ff932bf5507b5147d9d1ffc Check for file existance before blindly spawning them. Also, remove exit if spawn fails and try spawning subsequent scripts. --- diff --git a/python/vserver.py b/python/vserver.py index 33c1952..e638149 100644 --- a/python/vserver.py +++ b/python/vserver.py @@ -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: