diff --git a/charms/garr-dashboard/files/plugins/admin-costs/views.py b/charms/garr-dashboard/files/plugins/admin-costs/views.py index f9079eb1eb571117ecaf0ad80c6bfaa6deb4c0df..0e01622f4bb9302a4f2bfda9ed5faeac2bc3902b 100644 --- a/charms/garr-dashboard/files/plugins/admin-costs/views.py +++ b/charms/garr-dashboard/files/plugins/admin-costs/views.py @@ -157,8 +157,10 @@ class IndexView(tables.DataTableView): def get_price(self, resource, request, db_session): if resource['type'] == 'instance': - flavor_name = resource.get('flavor_name', None) - if not flavor_name: flavor_name = api.nova.flavor_get(request, resource['flavor_id']).name + flavor_name = resource.get('flavor_name', + api.nova.flavor_get(request, resource['flavor_id']).name) + if not flavor_name: + LOG.error('No such flavor %s' % flavor_name) flavor = db_session.query(Flavor).filter(Flavor.name == flavor_name).first() row_list = db_session.query(Price).filter(Price.resource == flavor.id, Price.type == 'flavor').all() elif resource['type'] == 'volume':