X-Git-Url: http://git.onelab.eu/?p=bootmanager.git;a=blobdiff_plain;f=source%2Fsteps%2FStartRunlevelAgent.py;h=718402102a679f7d4d16e39fd6c905e183e3fe49;hp=d4ee55c73ebc1dfc0a4becc20f942de398b655fe;hb=621647f8fad5b114a8bda1557ff1657c3efc7e22;hpb=d4be39e78e9a1a0c1885958e74189280a281be1b diff --git a/source/steps/StartRunlevelAgent.py b/source/steps/StartRunlevelAgent.py index d4ee55c..7184021 100644 --- a/source/steps/StartRunlevelAgent.py +++ b/source/steps/StartRunlevelAgent.py @@ -12,26 +12,25 @@ import os from Exceptions import * import BootAPI - -def Run( vars, log ): +def Run(vars, log): """ Start the RunlevelAgent.py script. Should follow AuthenticateWithPLC() in order to guarantee that /etc/planetlab/session is present. """ - log.write( "\n\nStep: Starting RunlevelAgent.py\n" ) + log.write("\n\nStep: Starting RunlevelAgent.py\n") try: - cmd = "%s/RunlevelAgent.py" % vars['BM_SOURCE_DIR'] + cmd = "{}/RunlevelAgent.py".format(vars['BM_SOURCE_DIR']) # raise error if script is not present. os.stat(cmd) # init script only starts RLA once. - os.system("/usr/bin/python %s start bootmanager &" % cmd) - except KeyError, var: - raise BootManagerException, "Missing variable in vars: %s\n" % var - except ValueError, var: - raise BootManagerException, "Variable in vars, shouldn't be: %s\n" % var + os.system("/usr/bin/python {} start bootmanager &".format(cmd)) + except KeyError as var: + raise BootManagerException("Missing variable in vars: {}\n".format(var)) + except ValueError as var: + raise BootManagerException("Variable in vars, shouldn't be: {}\n".format(var)) return 1