- # if bm not running, and plc bootstate = boot, then
- #api.ReportRunlevel({'run_level' : 'failboot'})
- #api.ReportRunlevel({'run_level' : 'reinstall'})
- # if bm not running, and plc bootstate = safeboot, then
- api.ReportRunlevel({'run_level' : 'safeboot'})
+ bs_val = extract_from('/tmp/bm.log', 'Current boot state:')
+ if len(bs_val) > 0: bs_val = bs_val.split()[-1]
+ ex_val = extract_from('/tmp/bm.log', 'Exception')
+ fs_val = extract_from('/tmp/bm.log', 'mke2fs')
+ bm_val = check_running("BootManager.py")
+
+ if bs_val in ['diag', 'diagnose', 'safeboot', 'disabled', 'disable']:
+ api.ReportRunlevel({'run_level' : 'safeboot'})
+
+ elif len(ex_val) > len("Exception"):
+ api.ReportRunlevel({'run_level' : 'failboot'})
+
+ elif len(fs_val) > 0 and len(bm_val) > 0:
+ api.ReportRunlevel({'run_level' : 'reinstall'})
+
+ else:
+ api.ReportRunlevel({'run_level' : 'failboot'})
+