Cinder Message API create failure "'NoneType' object is not subscriptable"

Bug #2009483 reported by Abhinav Shrivastava
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Cinder
In Progress
Medium
Abhinav Shrivastava

Bug Description

Tried to create message from cinder message api where 'action' was None.

2023-03-06 03:56:13.919 420861 ERROR oslo_messaging.rpc.server   File "/usr/lib/python3.9/site-packages/oslo_utils/excutils.py", line 227, in __exit__
2023-03-06 03:56:13.919 420861 ERROR oslo_messaging.rpc.server     self.force_reraise()
2023-03-06 03:56:13.919 420861 ERROR oslo_messaging.rpc.server   File "/usr/lib/python3.9/site-packages/oslo_utils/excutils.py", line 200, in force_reraise
2023-03-06 03:56:13.919 420861 ERROR oslo_messaging.rpc.server     raise self.value
2023-03-06 03:56:13.919 420861 ERROR oslo_messaging.rpc.server   File "/usr/lib/python3.9/site-packages/cinder/backup/manager.py", line 489, in continue_backup
2023-03-06 03:56:13.919 420861 ERROR oslo_messaging.rpc.server     self.message_api.create_from_request_context(
2023-03-06 03:56:13.919 420861 ERROR oslo_messaging.rpc.server   File "/usr/lib/python3.9/site-packages/cinder/message/api.py", line 140, in create_from_request_context
2023-03-06 03:56:13.919 420861 ERROR oslo_messaging.rpc.server     self.create(context=context,
2023-03-06 03:56:13.919 420861 ERROR oslo_messaging.rpc.server   File "/usr/lib/python3.9/site-packages/cinder/message/api.py", line 104, in create
2023-03-06 03:56:13.919 420861 ERROR oslo_messaging.rpc.server     action[0],
2023-03-06 03:56:13.919 420861 ERROR oslo_messaging.rpc.server TypeError: 'NoneType' object is not subscriptable
2023-03-06 03:56:13.919 420861 ERROR oslo_messaging.rpc.server

Revision history for this message
Abhinav Shrivastava (abshriva) wrote :

Changing this:
        message_record = {'project_id': context.project_id,
                          'request_id': context.request_id,
                          'resource_type': resource_type,
                          'resource_uuid': resource_uuid,
                          'action_id': action[0] if action else '',
                          'message_level': level,
                          'event_id': "VOLUME_%s_%s_%s" % (resource_type,
                                                           action[0],
                                                           detail_id),
                          'detail_id': detail_id,
                          'expires_at': expires_at}

to following fixes the issue:

        action_id = action[0] if action else ''
        message_record = {'project_id': context.project_id,
                          'request_id': context.request_id,
                          'resource_type': resource_type,
                          'resource_uuid': resource_uuid,
                          'action_id': action_id,
                          'message_level': level,
                          'event_id': "VOLUME_%s_%s_%s" % (resource_type,
                                                           action_id,
                                                           detail_id),
                          'detail_id': detail_id,
                          'expires_at': expires_at}

Changed in cinder:
assignee: nobody → Abhinav Shrivastava (abshriva)
Revision history for this message
Abhinav Shrivastava (abshriva) wrote :
Changed in cinder:
status: New → In Progress
summary: - Cinder Message API failure "'NoneType' object is not subscriptable"
+ Cinder Message API create failure "'NoneType' object is not
+ subscriptable"
Changed in cinder:
importance: Undecided → Medium
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to cinder (master)

Fix proposed to branch: master
Review: https://review.opendev.org/c/openstack/cinder/+/877966

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Related fix proposed to cinder (master)

Related fix proposed to branch: master
Review: https://review.opendev.org/c/openstack/cinder/+/877967

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.