X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=reboot.py;h=337b0b46f359fc173bf4283ced02445510b49873;hb=6d46ab9b534b60675a3dcb11fcb664589a3691f8;hp=f45a0a717fcbaead97335de77381d3479a2978fb;hpb=6496f5b4a0220e4055fee76c97f92293f9559117;p=monitor.git diff --git a/reboot.py b/reboot.py index f45a0a7..337b0b4 100755 --- a/reboot.py +++ b/reboot.py @@ -11,8 +11,6 @@ import urllib2 import urllib import threading, popen2 import array, struct -#from socket import * -import socket import plc import base64 from subprocess import PIPE, Popen @@ -706,7 +704,9 @@ class BayTechCtrlCUnibe(PCUControl): # Control Outlets (5 ,1).........5 try: - index = s.expect(["Enter Request :"]) + print s + print "Enter Request" in s.before + index = s.expect("Enter Request") if index == 0: print "3" @@ -786,7 +786,10 @@ class BayTechCtrlC(PCUControl): print "sending Y" s.send("Y\r\n") - index = s.expect(["DS-RPC>"]) + # NOTE: for some reason, the script times out with the + # following line. In manual tests, it works correctly, but + # with automated tests, evidently it fails. + #index = s.expect(["DS-RPC>"]) #print "got prompt back" s.close() @@ -1162,12 +1165,16 @@ def pcu_name(pcu): else: return None -import database -fb =database.dbLoad("findbadpcus") +#import database +from monitor import database +fb = None def get_pcu_values(pcu_id): - # TODO: obviously, this shouldn't be loaded each time... - + global fb + if fb == None: + # this shouldn't be loaded each time... + fb = database.dbLoad("findbadpcus") + try: values = fb['nodes']["id_%s" % pcu_id]['values'] except: