|
18 | 18 | import itertools |
19 | 19 | import sys |
20 | 20 |
|
21 | | -from openstack import exceptions as sdk_exceptions |
22 | | -from openstack.network.v2 import quota as _quota |
23 | 21 | from osc_lib.command import command |
24 | 22 | from osc_lib import utils |
25 | 23 | import six |
@@ -253,39 +251,7 @@ def get_network_quota(self, parsed_args): |
253 | 251 | project = self._get_project(parsed_args) |
254 | 252 | client = self.app.client_manager.network |
255 | 253 | if parsed_args.default: |
256 | | - # TODO(dtroyer): Remove the top of this if block once the |
257 | | - # fixed SDK QuotaDefault class is the minimum |
258 | | - # required version. This is expected to be |
259 | | - # SDK release 0.9.13 |
260 | | - if hasattr(_quota.QuotaDefault, 'project'): |
261 | | - # hack 0.9.11+ |
262 | | - quotadef_obj = client._get_resource( |
263 | | - _quota.QuotaDefault, |
264 | | - project, |
265 | | - ) |
266 | | - quotadef_obj.base_path = quotadef_obj.base_path % { |
267 | | - 'project': project, |
268 | | - } |
269 | | - try: |
270 | | - network_quota = quotadef_obj.get( |
271 | | - client.session, |
272 | | - requires_id=False, |
273 | | - ) |
274 | | - except sdk_exceptions.NotFoundException as e: |
275 | | - raise sdk_exceptions.ResourceNotFound( |
276 | | - message="No %s found for %s" % |
277 | | - (_quota.QuotaDefault.__name__, project), |
278 | | - details=e.details, |
279 | | - response=e.response, |
280 | | - request_id=e.request_id, |
281 | | - url=e.url, |
282 | | - method=e.method, |
283 | | - http_status=e.http_status, |
284 | | - cause=e.cause, |
285 | | - ) |
286 | | - # end hack-around |
287 | | - else: |
288 | | - network_quota = client.get_quota_default(project) |
| 254 | + network_quota = client.get_quota_default(project) |
289 | 255 | else: |
290 | 256 | network_quota = client.get_quota(project) |
291 | 257 | return network_quota |
|
0 commit comments