Run migration with NotFound exception as well

Gnocchi start returning regular 404 when requesting resource that do not
exist [1]. That means, that in case of 404, which is also excpected,
we just fail resource creation.

[1] http://paste.openstack.org/show/796938/

Change-Id: Ie5f8caba3111db7e7e8e50b9bc58c6e8de606338
This commit is contained in:
Dmitriy Rabotyagov 2020-08-19 12:18:21 +03:00
parent 49b098eda4
commit 648ce9b668

View File

@ -281,7 +281,7 @@ def upgrade_resource_types(conf):
elif ops['type'] == 'create_resource_type':
try:
gnocchi.resource_type.get(name=ops['resource_type'])
except gnocchi_exc.ResourceTypeNotFound:
except (gnocchi_exc.ResourceTypeNotFound, gnocchi_exc.NotFound):
rt = {'name': ops['resource_type'],
'attributes': ops['data'][0]['attributes']}
gnocchi.resource_type.create(resource_type=rt)