diff options
| author | xiexs <xiexs@cn.fujitsu.com> | 2015-11-29 22:29:57 -0500 |
|---|---|---|
| committer | xiexs <xiexs@cn.fujitsu.com> | 2015-11-29 22:30:04 -0500 |
| commit | 0ccd2a8108d71fffa1fda13022d52c3a38371ce6 (patch) | |
| tree | dbfb929d06d6d42c9f41db34398ba8ad0642c4b3 /openstackclient/common | |
| parent | 27869c0f3ffca5bd15700a198dd9e5929ea4d77d (diff) | |
| download | python-openstackclient-0ccd2a8108d71fffa1fda13022d52c3a38371ce6.tar.gz | |
Add project name/ID validation for "openstack quota show"
A validation is necessary to check the existence of project.
This patch is similar to Ia2d8c96527820e25b074e6486d3f39c5ad7eae60.
Change-Id: Id8895ba7a21ecad05942619a82a87c0dc68eae53
Diffstat (limited to 'openstackclient/common')
| -rw-r--r-- | openstackclient/common/quota.py | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/openstackclient/common/quota.py b/openstackclient/common/quota.py index c5404f07..8a9b910f 100644 --- a/openstackclient/common/quota.py +++ b/openstackclient/common/quota.py @@ -173,13 +173,19 @@ class ShowQuota(show.ShowOne): return parser def get_compute_volume_quota(self, client, parsed_args): + identity_client = self.app.client_manager.identity + project = utils.find_resource( + identity_client.projects, + parsed_args.project, + ).id + try: if parsed_args.quota_class: - quota = client.quota_classes.get(parsed_args.project) + quota = client.quota_classes.get(project) elif parsed_args.default: - quota = client.quotas.defaults(parsed_args.project) + quota = client.quotas.defaults(project) else: - quota = client.quotas.get(parsed_args.project) + quota = client.quotas.get(project) except Exception as e: if type(e).__name__ == 'EndpointNotFound': return {} |
