Scénario #33481
Zéphir : alertes par email non envoyées
Status:
Terminé (Sprint)
Priority:
Normal
Assigned To:
Category:
-
Target version:
Start date:
01/17/2022
Due date:
02/04/2022
% Done:
100%
Story points:
1.0
Remaining (hours):
0.00 hour
Velocity based estimate:
Release:
Release relationship:
Auto
Description
Les emails d'alertes ne sont jamais envoyés.
La configuration SMTP est ok (testé avec la commande exim -v destinataire@toto.com)
Extrait du fichier zephir_backend.alert.log :
2021-12-03T12:04:00.188020+01:00 zephir.cg65.local zephir_backend: [-] Traceback (most recent call last): 2021-12-03T12:04:00.188459+01:00 zephir.cg65.local zephir_backend: [-] File "/usr/lib/python3/dist-packages/zephir/backend/uucp_rpc.py", line 1362, in _send_alerte3 2021-12-03T12:04:00.188865+01:00 zephir.cg65.local zephir_backend: [-] envoi_ok, detail = self._sendmail(destinataires,subject + str(list(msg.keys())),"\n".join(list(msg.values()))) 2021-12-03T12:04:00.189177+01:00 zephir.cg65.local zephir_backend: [-] File "/usr/lib/python3/dist-packages/zephir/backend/uucp_rpc.py", line 1079, in _sendmail 2021-12-03T12:04:00.189508+01:00 zephir.cg65.local zephir_backend: [-] mail = email.MIMEText.MIMEText(msg) 2021-12-03T12:04:00.189828+01:00 zephir.cg65.local zephir_backend: [-] AttributeError: module 'email' has no attribute 'MIMEText' 2021-12-03T12:04:25.292417+01:00 zephir.cg65.local zephir_backend: [-] Unhandled Error
À corriger sur Zéphir >= 2.8.0
Subtasks
Associated revisions
Correction envoi de mail python3
Ref: #33481
History
#1 Updated by Joël Cuissinat almost 2 years ago
Encore un pb lié à la migration python3, visiblement, il faut remplacer :
email.MIMEText.MIMEText
par :
email.mime.text.MIMEText
#2 Updated by Joël Cuissinat almost 2 years ago
- Tracker changed from Demande to Tâche
- Status changed from Nouveau to En cours
- Assigned To set to Joël Cuissinat
- Parent task set to #33394
#3 Updated by Joël Cuissinat almost 2 years ago
- Status changed from En cours to Résolu
- % Done changed from 0 to 100
#4 Updated by mathieu carrolle almost 2 years ago
Après avoir appliqué la modification proposée, l'envoi d'email ne fonctionne pas. Il y a une erreur lors de la tentative de connexion SSL (methode starttls).
Pour tester, j'ai isolé la function _sendmail dans un fichier.
Trace:
Traceback (most recent call last): File "test-email.py", line 59, in _sendmail mail_client.starttls() File "/usr/lib/python3.8/smtplib.py", line 783, in starttls self.sock = context.wrap_socket(self.sock, File "/usr/lib/python3.8/ssl.py", line 500, in wrap_socket return self.sslsocket_class._create( File "/usr/lib/python3.8/ssl.py", line 1031, in _create self._sslobj = self._context._wrap_socket( ValueError: server_hostname cannot be an empty string or start with a leading dot. During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/usr/lib/python3.8/smtplib.py", line 358, in send self.sock.sendall(s) OSError: [Errno 9] Bad file descriptor During handling of the above exception, another exception occurred: Traceback (most recent call last): File "test-email.py", line 61, in _sendmail mail_client.quit() File "/usr/lib/python3.8/smtplib.py", line 997, in quit res = self.docmd("quit") File "/usr/lib/python3.8/smtplib.py", line 424, in docmd self.putcmd(cmd, args) File "/usr/lib/python3.8/smtplib.py", line 371, in putcmd self.send(str) File "/usr/lib/python3.8/smtplib.py", line 361, in send raise SMTPServerDisconnected('Server not connected') smtplib.SMTPServerDisconnected: Server not connected During handling of the above exception, another exception occurred: Traceback (most recent call last): File "test-email.py", line 72, in <module> _sendmail("mathieu.carrolle@ha-py.fr","test","toto") File "test-email.py", line 66, in _sendmail mail_client.quit() File "/usr/lib/python3.8/smtplib.py", line 997, in quit res = self.docmd("quit") File "/usr/lib/python3.8/smtplib.py", line 424, in docmd self.putcmd(cmd, args) File "/usr/lib/python3.8/smtplib.py", line 371, in putcmd self.send(str) File "/usr/lib/python3.8/smtplib.py", line 363, in send raise SMTPServerDisconnected('please run connect() first') smtplib.SMTPServerDisconnected: please run connect() first
#5 Updated by Joël Cuissinat almost 2 years ago
- Status changed from Résolu to Nouveau
- Parent task deleted (
#33394)
#6 Updated by Joël Cuissinat almost 2 years ago
- Tracker changed from Tâche to Scénario
- Subject changed from Alertes par email non envoyées to Zéphir : alertes par email non envoyées
- Assigned To deleted (
Joël Cuissinat) - Target version deleted (
sprint 2021 46-49 Equipe MENSR) - Start date deleted (
12/03/2021) - Release set to Carnet de produit (Cadoles)
- Story points set to 1.0
#7 Updated by Joël Cuissinat over 1 year ago
- Description updated (diff)
#8 Updated by Gilles Grandgérard over 1 year ago
- Due date set to 02/04/2022
- Target version set to Prestation Cadoles MEN 2022 03-05
- Start date set to 01/17/2022
#9 Updated by Celine Rappeneau over 1 year ago
- Assigned To set to Matthieu Lamalle
#10 Updated by Matthieu Lamalle over 1 year ago
Problème identifié
https://github.com/ansible/ansible/pull/44552
#11 Updated by Joël Cuissinat over 1 year ago
- Status changed from Nouveau to Terminé (Sprint)
- Release changed from Carnet de produit (Cadoles) to EOLE 2.8.0