You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
While working on a different issue: #12166, related to the virtual environment cornjobs setup, I figured out the checkProxy.py script silently fails for any setup of ours, being it venv or docker. Once I executed the command manually in one WMAgent docker container I got the error:
(WMAgent-2.3.4.4) [cmst1@vocms0290:current]$ python /usr/local/deploy/checkProxy.py --proxy /data/certs/myproxy.pem
Traceback (most recent call last):
File "/usr/local/deploy/checkProxy.py", line 164, in <module>
main(sys.argv[1:])
File "/usr/local/deploy/checkProxy.py", line 82, in main
proxyInfo = [line for line in out.split('\n') if line]
TypeError: a bytes-like object is required, not 'str'
Here is the set of cronjobs installed at the container:
So all consecutive comparisons/interactions between a str and a bytes type objects fail with the same error (I went further down the code, it happens in few other places as well).
This can explain why @amaltaro suddenly stopped receiving those email warnings regarding proxy expiration for all agents. The script simply never reaches to the point to send an email to anybody, it simply fails with the above error, and because the crontab errors are redirected to the account which is running the crontab, they all go to the cmst1 user e-mail and we never knew. I happened to stumble on those, only because I was fixing the virtenv cronjobs , and those were run with my account, so they started to spam my personal mail. If it was not this coincidence we would have been still let in the dark.
How to reproduce it
Run the cronjob mentioned above manually
Expected behavior
The script for sending those warning e-mails to the relevant person to work.
Additional context and error message
Few more str to bytes comparison errors from the same script:
File /data/WMAgent.venv3/deploy/checkProxy.py:123, in processTimeLeft(sendMail, verbose, proxyInfo, time, mail)
121 timeLeft = []
122 for line in proxyInfo:
--> 123 if line.find('timeleft') > -1:
124 dateReg = re.compile('\d{1,3}[:/]\d{2}[:/]\d{2}')
125 timeLeft = dateReg.findall(line)[0]
TypeError: argument should be integer or bytes-like object, not 'str'
File /data/WMAgent.venv3/deploy/checkProxy.py:125, in processTimeLeft(sendMail, verbose, proxyInfo, time, mail)
123 if line.find(b'timeleft') > -1:
124 dateReg = re.compile('\d{1,3}[:/]\d{2}[:/]\d{2}')
--> 125 timeLeft = dateReg.findall(line)[0]
126 timeLeft = timeLeft.split(':')[0]
127 continue
TypeError: cannot use a string pattern on a bytes-like object
File /data/WMAgent.venv3/deploy/checkProxy.py:126, in processTimeLeft(sendMail, verbose, proxyInfo, time, mail)
124 dateReg = re.compile(b'\d{1,3}[:/]\d{2}[:/]\d{2}')
125 timeLeft = dateReg.findall(line)[0]
--> 126 timeLeft = timeLeft.split(':')[0]
127 continue
128 else:
TypeError: a bytes-like object is required, not 'str'
The text was updated successfully, but these errors were encountered:
Impact of the bug
WMAgent
Describe the bug
While working on a different issue: #12166, related to the virtual environment cornjobs setup, I figured out the
checkProxy.py
script silently fails for any setup of ours, being itvenv
ordocker
. Once I executed the command manually in one WMAgent docker container I got the error:Here is the set of cronjobs installed at the container:
So the error occurs, because since a while now, the system execution of a sub process from this line here, returns a
bytes
object rather than astr
:WMCore/deploy/checkProxy.py
Line 90 in 76fd3a9
proxyInfo
object on the very next line is not a string anymore:WMCore/deploy/checkProxy.py
Line 91 in 76fd3a9
So all consecutive comparisons/interactions between a
str
and abytes
type objects fail with the same error (I went further down the code, it happens in few other places as well).This can explain why @amaltaro suddenly stopped receiving those email warnings regarding proxy expiration for all agents. The script simply never reaches to the point to send an email to anybody, it simply fails with the above error, and because the crontab errors are redirected to the account which is running the crontab, they all go to the
cmst1
user e-mail and we never knew. I happened to stumble on those, only because I was fixing the virtenv cronjobs , and those were run with my account, so they started to spam my personal mail. If it was not this coincidence we would have been still let in the dark.How to reproduce it
Run the cronjob mentioned above manually
Expected behavior
The script for sending those warning e-mails to the relevant person to work.
Additional context and error message
Few more
str
tobytes
comparison errors from the same script:The text was updated successfully, but these errors were encountered: