From 719f09323280512f6ac50fc2e589d20102727f02 Mon Sep 17 00:00:00 2001 From: Marc Fiuczynski Date: Thu, 13 Jul 2006 19:50:43 +0000 Subject: [PATCH] Cleaned up NodeRunStates handling --- source/BootManager.py | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/source/BootManager.py b/source/BootManager.py index 9df68db..5519af4 100755 --- a/source/BootManager.py +++ b/source/BootManager.py @@ -75,11 +75,7 @@ BIN_PATH= ('/usr/local/bin', # the set of valid node run states -NodeRunStates = {'new':None, - 'inst':None, - 'rins':None, - 'boot':None, - 'dbg':None} +NodeRunStates = {} class log: @@ -348,8 +344,14 @@ class BootManager: def main(argv): global NodeRunStates - # set to 0 if no error occurred - error= 1 + NodeRunStates = {'new':None, + 'inst':None, + 'rins':None, + 'boot':None, + 'dbg':None} + + # set to 1 if error occurred + error= 0 # all output goes through this class so we can save it and post # the data back to PlanetLab central @@ -364,9 +366,9 @@ def main(argv): fState = argv[1] if NodeRunStates.has_key(fState): forceState = fState - error = 0 else: LOG.LogEntry("FATAL: cannot force node run state to=%s" % fState) + error = 1 except: traceback.print_exc(file=LOG.OutputFile) traceback.print_exc() @@ -376,8 +378,6 @@ def main(argv): strftime("%a, %d %b %Y %H:%M:%S +0000", gmtime()) ) LOG.Upload() return error - else: - error = 1 try: bm= BootManager(LOG,forceState) @@ -389,9 +389,9 @@ def main(argv): success= bm.Run() if success: LOG.LogEntry( "\nDone!" ); - error = 0 else: LOG.LogEntry( "\nError occurred!" ); + error = 1 except: traceback.print_exc(file=LOG.OutputFile) traceback.print_exc() -- 2.43.0