catch an exception from DRAC logins when the connection is closed early.
[monitor.git] / pcubad.py
index b31599f..13fce72 100755 (executable)
--- a/pcubad.py
+++ b/pcubad.py
@@ -7,14 +7,15 @@ import time
 from datetime import datetime,timedelta
 
 from monitor import database
-from pcucontrol  import reboot
+from monitor import reboot
 from monitor import parser as parsermodule
 from monitor import config
 from monitor.database.info.model import HistoryPCURecord, FindbadPCURecord
+from monitor.database.dborm import mon_session as session
 from monitor.wrapper import plc,plccache
 from monitor.const import MINUP
 
-from nodecommon import *
+from monitor.common import *
 from nodequery import verify,query_to_dict,node_select
 from monitor.model import *
 
@@ -93,6 +94,7 @@ def checkAndRecordState(l_pcus, l_plcpcus):
        # replace with another operations that also commits all pending ops, such
        # as session.commit() or flush() or something
        print HistoryPCURecord.query.count()
+       session.flush()
 
        return True