X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=source%2Fsteps%2FStopRunlevelAgent.py;fp=source%2Fsteps%2FStopRunlevelAgent.py;h=c88b35f430567863e321a42e6e7f2fc339d58bb7;hb=38b7fdabf9fe462f585acce3e5eef35d2e7c436d;hp=0000000000000000000000000000000000000000;hpb=f42e550320ca54ea6439e0b54aa165ea11e1f3a3;p=bootmanager.git diff --git a/source/steps/StopRunlevelAgent.py b/source/steps/StopRunlevelAgent.py new file mode 100644 index 0000000..c88b35f --- /dev/null +++ b/source/steps/StopRunlevelAgent.py @@ -0,0 +1,43 @@ +#!/usr/bin/python +# +# Copyright (c) 2003 Intel Corporation +# All rights reserved. +# +# Copyright (c) 2004-2006 The Trustees of Princeton University +# All rights reserved. + + +import os + +from Exceptions import * +import BootAPI + + +def Run( vars, log ): + """ + Stop the RunlevelAgent.py script. Should proceed + kexec to reset run_level to 'boot' before kexec + """ + + log.write( "\n\nStep: Stopping RunlevelAgent.py\n" ) + + try: + cmd = "%s/RunlevelAgent.py" % vars['BM_SOURCE_DIR'] + # raise error if script is not present. + os.stat(cmd) + os.system("/usr/bin/python %s stop" % 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 + + try: + update_vals= {} + update_vals['run_level']='boot' + BootAPI.call_api_function( vars, "ReportRunlevel", (update_vals,) ) + except BootManagerException, e: + log.write( "Unable to update boot state for this node at PLC: %s.\n" % e ) + + return 1 + +