third_part smtp_mode failed due to type error in python3

Bug #2029392 reported by Xing Zhang
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
zaqar
Fix Released
Undecided
Unassigned

Bug Description

failed to send email when smtp_mode is configured to third_part:

2023-08-02 16:27:27.077 7 INFO zaqar.notification.notifier [req-1fbf1274-6793-489c-93da-58cb18a5f782 05c9cff054934f67b3e856644c4d3592 26d7292e19774975896562ae389b876b - default default] [project_id:26d7292e19774975896562ae389b876b] Begin to send mailto confirm/unsubscribe notification. The request body is {'WSGISubscribeURL': 'http://10.0.6.30:8888/v2/queues/notice/subscriptions/0df1ccb1-daff-4436-b5d7-0b94da0adcd4/confirm', 'Message_Type': 'SubscriptionConfirmation', 'Message': 'You have chosen to subscribe to the queue: notice', 'URL-Signature': 'bb38609b0b281988a038821ae127edc7d6de072f2d4df8326edbc2b7792aa316', 'URL-Methods': 'PUT', 'URL-Paths': '/v2/queues/notice/subscriptions/0df1ccb1-daff-4436-b5d7-0b94da0adcd4/confirm', 'X-Project-ID': '26d7292e19774975896562ae389b876b', 'URL-Expires': '2023-08-02T09:27:26', 'SubscribeBody': {'confirmed': True}, 'UnsubscribeBody': {'confirmed': False}}
2023-08-02 16:27:27.085 7 ERROR zaqar.notification.tasks.mailto [-] Failed to send email because a bytes-like object is required, not 'str'.: TypeError: a bytes-like object is required, not 'str'
2023-08-02 16:27:27.085 7 ERROR zaqar.notification.tasks.mailto Traceback (most recent call last):
2023-08-02 16:27:27.085 7 ERROR zaqar.notification.tasks.mailto File "/usr/lib/python3.9/site-packages/zaqar/notification/tasks/mailto.py", line 103, in execute
2023-08-02 16:27:27.085 7 ERROR zaqar.notification.tasks.mailto p.communicate(msg.as_string())
2023-08-02 16:27:27.085 7 ERROR zaqar.notification.tasks.mailto File "/usr/lib64/python3.9/subprocess.py", line 1119, in communicate
2023-08-02 16:27:27.085 7 ERROR zaqar.notification.tasks.mailto self._stdin_write(input)
2023-08-02 16:27:27.085 7 ERROR zaqar.notification.tasks.mailto File "/usr/lib64/python3.9/subprocess.py", line 1068, in _stdin_write
2023-08-02 16:27:27.085 7 ERROR zaqar.notification.tasks.mailto self.stdin.write(input)
2023-08-02 16:27:27.085 7 ERROR zaqar.notification.tasks.mailto TypeError: a bytes-like object is required, not 'str'
2023-08-02 16:27:27.085 7 ERROR zaqar.notification.tasks.mailto
2023-08-02 16:28:28.804 7 INFO zaqar.notification.notifier [req-4d6dae0c-179c-485e-b0d8-e0a1cfe6b7d9 05c9cff054934f67b3e856644c4d3592 26d7292e19774975896562ae389b876b - default default] [project_id:26d7292e19774975896562ae389b876b] Begin to send mailto confirm/unsubscribe notification. The request body is {'WSGISubscribeURL': 'http://10.0.6.30:8888/v2/queues/notice/subscriptions/810bd1bd-7aee-4d20-aefb-be21c65f7a07/confirm', 'Message_Type': 'SubscriptionConfirmation', 'Message': 'You have chosen to subscribe to the queue: notice', 'URL-Signature': 'fb61950f063e6c80ce5982a8c226142048f65b877703cbd55536254ff2c18795', 'URL-Methods': 'PUT', 'URL-Paths': '/v2/queues/notice/subscriptions/810bd1bd-7aee-4d20-aefb-be21c65f7a07/confirm', 'X-Project-ID': '26d7292e19774975896562ae389b876b', 'URL-Expires': '2023-08-02T09:28:28', 'SubscribeBody': {'confirmed': True}, 'UnsubscribeBody': {'confirmed': False}}

Changed in zaqar:
status: New → In Progress
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to zaqar (master)

Reviewed: https://review.opendev.org/c/openstack/zaqar/+/890347
Committed: https://opendev.org/openstack/zaqar/commit/e0937b1f097f72238033ccc7182c88ab870bc23f
Submitter: "Zuul (22348)"
Branch: master

commit e0937b1f097f72238033ccc7182c88ab870bc23f
Author: Xing Zhang <email address hidden>
Date: Thu Aug 3 00:06:44 2023 +0800

    Use processutils to fix TypeError in subprocess

    Calling processutils.execute() other than subprocess to
    fix bytes-like and str issue in python3.

    Closes-bug: #2029392
    Change-Id: I16436aa19da2cf53951c9ad27bca14033194651a

Changed in zaqar:
status: In Progress → Fix Released
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to zaqar (stable/2023.1)

Fix proposed to branch: stable/2023.1
Review: https://review.opendev.org/c/openstack/zaqar/+/892302

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to zaqar (stable/zed)

Fix proposed to branch: stable/zed
Review: https://review.opendev.org/c/openstack/zaqar/+/892303

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to zaqar (stable/yoga)

Fix proposed to branch: stable/yoga
Review: https://review.opendev.org/c/openstack/zaqar/+/892304

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to zaqar (stable/xena)

Fix proposed to branch: stable/xena
Review: https://review.opendev.org/c/openstack/zaqar/+/892305

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to zaqar (stable/wallaby)

Fix proposed to branch: stable/wallaby
Review: https://review.opendev.org/c/openstack/zaqar/+/892307

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to zaqar (stable/victoria)

Fix proposed to branch: stable/victoria
Review: https://review.opendev.org/c/openstack/zaqar/+/892308

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to zaqar (stable/ussuri)

Fix proposed to branch: stable/ussuri
Review: https://review.opendev.org/c/openstack/zaqar/+/892309

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to zaqar (stable/train)

Fix proposed to branch: stable/train
Review: https://review.opendev.org/c/openstack/zaqar/+/892310

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix included in openstack/zaqar 17.0.0.0rc1

This issue was fixed in the openstack/zaqar 17.0.0.0rc1 release candidate.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.