X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=source%2Fsteps%2FUpdateBootStateWithPLC.py;h=cb9cff3ca1afda3b4b6a205a24e7c4959c9ba995;hb=8381dfe5e46033ee8003bc2e3536002caf64bc16;hp=417dd12b5acaa956960733322ee8a3b32daf1bf9;hpb=7ab7e9dd797333a9fdc8604554e16e192a32144d;p=bootmanager.git diff --git a/source/steps/UpdateBootStateWithPLC.py b/source/steps/UpdateBootStateWithPLC.py index 417dd12..cb9cff3 100644 --- a/source/steps/UpdateBootStateWithPLC.py +++ b/source/steps/UpdateBootStateWithPLC.py @@ -1,3 +1,11 @@ +#!/usr/bin/python2 -u + +# Copyright (c) 2003 Intel Corporation +# All rights reserved. +# +# Copyright (c) 2004-2006 The Trustees of Princeton University +# All rights reserved. + from Exceptions import * import BootAPI import notify_messages @@ -22,29 +30,31 @@ def Run( vars, log ): update_vals= {} update_vals['boot_state']= vars['BOOT_STATE'] - BootAPI.call_api_function( vars, "BootUpdateNode", (update_vals,) ) - - log.write( "Successfully updated boot state for this node at PLC\n" ) - - - if "STATE_CHANGE_NOTIFY" in vars.keys(): - if vars["STATE_CHANGE_NOTIFY"] == 1: - message= vars['STATE_CHANGE_NOTIFY_MESSAGE'] - include_pis= 0 - include_techs= 1 - include_support= 0 - - sent= 0 - try: - sent= BootAPI.call_api_function( vars, "BootNotifyOwners", - (message, - include_pis, - include_techs, - include_support) ) - except BootManagerException, e: - log.write( "Call to BootNotifyOwners failed: %s.\n" % e ) - - if sent == 0: - log.write( "Unable to notify site contacts of state change.\n" ) - + try: + BootAPI.call_api_function( vars, "BootUpdateNode", (update_vals,) ) + log.write( "Successfully updated boot state for this node at PLC\n" ) + except BootManagerException, e: + log.write( "Unable to update boot state for this node at PLC: %s.\n" % e ) + + notify = vars.get("STATE_CHANGE_NOTIFY",0) + + if notify: + message= vars['STATE_CHANGE_NOTIFY_MESSAGE'] + include_pis= 0 + include_techs= 1 + include_support= 0 + + sent= 0 + try: + sent= BootAPI.call_api_function( vars, "BootNotifyOwners", + (message, + include_pis, + include_techs, + include_support) ) + except BootManagerException, e: + log.write( "Call to BootNotifyOwners failed: %s.\n" % e ) + + if sent == 0: + log.write( "Unable to notify site contacts of state change.\n" ) + return 1