Skip to content

Commit cde16c2

Browse files
authored
Merge pull request #12175 from todor-ivanov/bugfix_WMAgent_CheckProxySilentFailure_fix-12173_backport-2.3.7_wmagent
Fix str to bytes comparisons in checkProxy.py
2 parents 2ad11f1 + 979ec9e commit cde16c2

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

deploy/checkProxy.py

+5-5
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ def main(argv):
7979
command = ["voms-proxy-info", "-file", str(proxy)]
8080
p = subprocess.Popen(command, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
8181
out, _err = p.communicate()
82-
proxyInfo = [line for line in out.split('\n') if line]
82+
proxyInfo = [line for line in out.split(b'\n') if line]
8383
processTimeLeft(sendMail, verbose, proxyInfo, time, mail)
8484

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

9494

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

0 commit comments

Comments
 (0)