mirror of
https://github.com/ElvishArtisan/rivendell.git
synced 2025-10-12 17:43:41 +02:00
2019-08-26 Fred Gleason <fredg@paravelsystems.com>
* Fixed a bug in the 'pypad_walltime.py' PyPAD script that caused an infinite loop.
This commit is contained in:
@@ -32,27 +32,25 @@ def eprint(*args,**kwargs):
|
||||
|
||||
def ProcessPad(update):
|
||||
n=1
|
||||
try:
|
||||
while(True):
|
||||
section='Walltime'+str(n)
|
||||
if update.shouldBeProcessed(section):
|
||||
fmtstr=update.config().get(section,'FormatString')
|
||||
buf=BytesIO(update.resolvePadFields(fmtstr,pypad.ESCAPE_NONE).encode('utf-8'))
|
||||
curl=pycurl.Curl()
|
||||
curl.setopt(curl.URL,'http://'+update.config().get(section,'IpAddress')+'/webwidget');
|
||||
curl.setopt(curl.USERNAME,'user')
|
||||
curl.setopt(curl.PASSWORD,update.config().get(section,'Password'))
|
||||
curl.setopt(curl.UPLOAD,True)
|
||||
curl.setopt(curl.READDATA,buf)
|
||||
try:
|
||||
curl.perform()
|
||||
except pycurl.error:
|
||||
update.syslog(syslog.LOG_WARNING,'['+section+'] failed: '+curl.errstr())
|
||||
curl.close()
|
||||
n=n+1
|
||||
section='Walltime'+str(n)
|
||||
while(update.config().has_section(section)):
|
||||
if update.shouldBeProcessed(section):
|
||||
fmtstr=update.config().get(section,'FormatString')
|
||||
buf=BytesIO(update.resolvePadFields(fmtstr,pypad.ESCAPE_NONE).encode('utf-8'))
|
||||
curl=pycurl.Curl()
|
||||
curl.setopt(curl.URL,'http://'+update.config().get(section,'IpAddress')+'/webwidget');
|
||||
curl.setopt(curl.USERNAME,'user')
|
||||
curl.setopt(curl.PASSWORD,update.config().get(section,'Password'))
|
||||
curl.setopt(curl.UPLOAD,True)
|
||||
curl.setopt(curl.READDATA,buf)
|
||||
try:
|
||||
curl.perform()
|
||||
except pycurl.error:
|
||||
update.syslog(syslog.LOG_WARNING,'['+section+'] failed: '+curl.errstr())
|
||||
curl.close()
|
||||
n=n+1
|
||||
section='Walltime'+str(n)
|
||||
|
||||
except configparser.NoSectionError:
|
||||
return
|
||||
|
||||
#
|
||||
# 'Main' function
|
||||
|
Reference in New Issue
Block a user