Skip to content

Commit a8d71d5

Browse files
committed
quotas: do not fail to set/delete if an endpoint is missing
If you attempted to set or delete a nova quota but the neutron endpoint was missing but the network service existed, it would fail. The show command handled this gracefully and had options to allow you to just show the services that you were interested in. This lead to poor UX. Closes-Bug: #2150251 Assisted-by: Claude Sonnet 4.6 Change-Id: I6a65a00a9cd25e5a6b644d0e8cc5a216a49ae979 Signed-off-by: Doug Goldstein <cardoe@cardoe.com>
1 parent 6a540c1 commit a8d71d5

2 files changed

Lines changed: 17 additions & 5 deletions

File tree

openstackclient/common/quota.py

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -593,6 +593,9 @@ def take_action(self, parsed_args: argparse.Namespace) -> None:
593593
compute_kwargs = {}
594594
volume_kwargs = {}
595595
network_kwargs = {}
596+
compute_client = None
597+
volume_client = None
598+
network_client = None
596599

597600
if self.app.client_manager.is_compute_endpoint_enabled():
598601
compute_client = self.app.client_manager.compute
@@ -636,12 +639,12 @@ def take_action(self, parsed_args: argparse.Namespace) -> None:
636639
network_kwargs['check_limit'] = True
637640

638641
if parsed_args.quota_class or parsed_args.default:
639-
if compute_kwargs:
642+
if compute_kwargs and compute_client:
640643
compute_client.update_quota_class_set(
641644
parsed_args.project or 'default',
642645
**compute_kwargs,
643646
)
644-
if volume_kwargs:
647+
if volume_kwargs and volume_client:
645648
volume_client.update_quota_class_set(
646649
parsed_args.project or 'default',
647650
**volume_kwargs,
@@ -657,11 +660,11 @@ def take_action(self, parsed_args: argparse.Namespace) -> None:
657660
project_info = get_project(self.app, parsed_args.project)
658661
project = project_info['id']
659662

660-
if compute_kwargs:
663+
if compute_kwargs and compute_client:
661664
compute_client.update_quota_set(project, **compute_kwargs)
662-
if volume_kwargs:
665+
if volume_kwargs and volume_client:
663666
volume_client.update_quota_set(project, **volume_kwargs)
664-
if network_kwargs:
667+
if network_kwargs and network_client:
665668
network_client.update_quota(project, **network_kwargs)
666669

667670

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
---
2+
fixes:
3+
- |
4+
When attempting to set or delete a quota for nova the command can fail if
5+
the endpoint for the service does not exist but the service does. An
6+
endpoint is a service at a specific region for a specific interface. The
7+
other quota commands gracefully handle this leading it not being possible
8+
to set or delete a quota in this case but to be able to see it.
9+
[`Bug 2150251 <https://bugs.launchpad.net/python-openstackclient/+bug/2150251>`_]

0 commit comments

Comments
 (0)