Show correct name for resource with quota set to zero

In case quota for the resource is set to zero "openstack quota show"
command will not map the resource name according to one of the
following dicts:
 - COMPUTE_QUOTAS
 - NOVA_NETWORK_QUOTAS
 - VOLUME_QUOTAS
 - NETWORK_QUOTAS

For example:
$ openstack quota set --secgroups 10 admin
$ openstack quota show admin -f json|egrep "(secgroups|security_groups)"
  "secgroups": 10,
$ openstack quota set --secgroups 0 admin
$ openstack quota show admin -f json|egrep "(secgroups|security_groups)"
  "security_groups": 0,

Change-Id: I94ed9e6b41b1cc692297c01e6c7582998dcacfda
This commit is contained in:
Alex Katz 2020-01-05 14:08:04 +02:00 committed by Alex Katz
parent 5b3a827a1f
commit 780d9b49a0
1 changed files with 1 additions and 1 deletions

View File

@ -650,7 +650,7 @@ class ShowQuota(command.ShowOne, BaseQuota):
for k, v in itertools.chain(
COMPUTE_QUOTAS.items(), NOVA_NETWORK_QUOTAS.items(),
VOLUME_QUOTAS.items(), NETWORK_QUOTAS.items()):
if not k == v and info.get(k):
if not k == v and info.get(k) is not None:
info[v] = info[k]
info.pop(k)