From d40d6a2e82b248543438fd5d24d2985a61c33a93 Mon Sep 17 00:00:00 2001 From: Stephen Finucane Date: Wed, 10 Jul 2024 11:39:18 +0100 Subject: [PATCH] compute: Correct base path for default, detailed quotas For some reason, you need to include the project ID in the path even though it's wholly ignored. Change-Id: I805cdfaa89134e92eeb9726697925e9d0657af19 Signed-off-by: Stephen Finucane --- openstack/compute/v2/_proxy.py | 7 +++++-- openstack/tests/unit/cloud/test_quotas.py | 1 - openstack/tests/unit/compute/v2/test_proxy.py | 5 ++--- 3 files changed, 7 insertions(+), 6 deletions(-) diff --git a/openstack/compute/v2/_proxy.py b/openstack/compute/v2/_proxy.py index 0ef062387..419fb4dd9 100644 --- a/openstack/compute/v2/_proxy.py +++ b/openstack/compute/v2/_proxy.py @@ -2465,7 +2465,8 @@ class Proxy(proxy.Proxy): None, project_id=project.id, ) - return res.fetch(self, usage=usage, **query) + base_path = '/os-quota-sets/%(project_id)s/detail' if usage else None + return res.fetch(self, base_path=base_path, **query) def get_quota_set_defaults(self, project): """Show QuotaSet defaults for the project @@ -2484,7 +2485,9 @@ class Proxy(proxy.Proxy): None, project_id=project.id, ) - return res.fetch(self, base_path='/os-quota-sets/defaults') + return res.fetch( + self, base_path='/os-quota-sets/%(project_id)s/defaults' + ) def revert_quota_set(self, project, **query): """Reset Quota for the project/user. diff --git a/openstack/tests/unit/cloud/test_quotas.py b/openstack/tests/unit/cloud/test_quotas.py index 50dbe7f41..d02b2e7d8 100644 --- a/openstack/tests/unit/cloud/test_quotas.py +++ b/openstack/tests/unit/cloud/test_quotas.py @@ -125,7 +125,6 @@ class TestQuotas(base.TestCase): 'compute', 'public', append=['os-quota-sets', project.project_id], - qs_elements=['usage=False'], ), json={'quota_set': fake_quota_set}, ), diff --git a/openstack/tests/unit/compute/v2/test_proxy.py b/openstack/tests/unit/compute/v2/test_proxy.py index 5c11d9e2a..38a6474ec 100644 --- a/openstack/tests/unit/compute/v2/test_proxy.py +++ b/openstack/tests/unit/compute/v2/test_proxy.py @@ -1642,7 +1642,6 @@ class TestQuotaSet(TestComputeProxy): expected_kwargs={ 'error_message': None, 'requires_id': False, - 'usage': False, }, method_result=quota_set.QuotaSet(), expected_result=quota_set.QuotaSet(), @@ -1658,8 +1657,8 @@ class TestQuotaSet(TestComputeProxy): expected_kwargs={ 'error_message': None, 'requires_id': False, - 'usage': True, 'user_id': 'uid', + 'base_path': '/os-quota-sets/%(project_id)s/detail', }, ) @@ -1672,7 +1671,7 @@ class TestQuotaSet(TestComputeProxy): expected_kwargs={ 'error_message': None, 'requires_id': False, - 'base_path': '/os-quota-sets/defaults', + 'base_path': '/os-quota-sets/%(project_id)s/defaults', }, )