Skip to content

Commit

Permalink
Merge pull request #12175 from todor-ivanov/bugfix_WMAgent_CheckProxy…
Browse files Browse the repository at this point in the history
…SilentFailure_fix-12173_backport-2.3.7_wmagent

Fix str to bytes comparisons in checkProxy.py
  • Loading branch information
amaltaro authored Nov 26, 2024
2 parents 2ad11f1 + 979ec9e commit cde16c2
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions deploy/checkProxy.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ def main(argv):
command = ["voms-proxy-info", "-file", str(proxy)]
p = subprocess.Popen(command, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
out, _err = p.communicate()
proxyInfo = [line for line in out.split('\n') if line]
proxyInfo = [line for line in out.split(b'\n') if line]
processTimeLeft(sendMail, verbose, proxyInfo, time, mail)

if myproxy:
Expand All @@ -88,7 +88,7 @@ def main(argv):
command = ["myproxy-info", "-v", "-l", "amaltaro", "-s", "myproxy.cern.ch", "-k", "amaltaroCERN"]
p = subprocess.Popen(command, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
out, err = p.communicate()
proxyInfo = [line for line in out.split('\n') if line]
proxyInfo = [line for line in out.split(b'\n') if line]
processTimeLeft(sendMail, verbose, proxyInfo, time, mail)


Expand Down Expand Up @@ -121,10 +121,10 @@ def processTimeLeft(sendMail, verbose, proxyInfo, time, mail):
print('Proxy information: {}'.format(proxyInfo))
timeLeft = []
for line in proxyInfo:
if line.find('timeleft') > -1:
dateReg = re.compile('\d{1,3}[:/]\d{2}[:/]\d{2}')
if line.find(b'timeleft') > -1:
dateReg = re.compile(b'\d{1,3}[:/]\d{2}[:/]\d{2}')
timeLeft = dateReg.findall(line)[0]
timeLeft = timeLeft.split(':')[0]
timeLeft = timeLeft.split(b':')[0]
continue
else:
msg = "No valid proxy found in %s. " % HOST
Expand Down

0 comments on commit cde16c2

Please sign in to comment.