Using pop method to avoid incompatible data type

Descrption:
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: 'set' object does not support indexing

Solution:
for set, use pop method instead of index.

Change-Id: I33523ddb8aabf45eb11dd9816c52b0ef77d05296
This commit is contained in:
chenker 2021-03-31 15:44:05 +08:00
parent 12f8e38631
commit abe9f40fba

View File

@ -61,7 +61,7 @@ class NovaAPI(object):
else:
msg = _('Unexpected event code %(code)s '
'for instance %(inst)s')
msg = msg % {'code': event_codes[0],
msg = msg % {'code': event_codes.pop(),
'inst': events[0]["server_uuid"]}
raise exception.InvalidAPIResponse(
service='Nova', api=url[1:], msg=msg)