Add project param in LimitList parser
when doing openstack limit list --project xyz_id, CLI raising error unrecognized arguments, whereas in api-ref document [1], user can pass project_id as query param.This addresses the above issue, by adding param --project in parser of LimitList. [1] https://developer.openstack.org/api-ref/identity/v3/index.html Change-Id: If4644cc99a3803f61f4a688b828aeb73977fc0dd Closes-Bug: #1798744
This commit is contained in:
parent
02f492ae4c
commit
0d764cdb5a
@ -73,6 +73,7 @@ List project-specific limits
|
||||
[--service <service>]
|
||||
[--resource-name <resource-name>]
|
||||
[--region <region>]
|
||||
[--project <project>]
|
||||
|
||||
.. option:: --service <service>
|
||||
|
||||
@ -86,6 +87,10 @@ List project-specific limits
|
||||
|
||||
The region name to filter the response by
|
||||
|
||||
.. option:: --project <project>
|
||||
|
||||
List resource limits associated with project
|
||||
|
||||
limit show
|
||||
----------
|
||||
|
||||
|
@ -116,6 +116,11 @@ class ListLimit(command.Lister):
|
||||
metavar='<region>',
|
||||
help=_('Region for the registered limit to affect.'),
|
||||
)
|
||||
parser.add_argument(
|
||||
'--project',
|
||||
metavar='<project>',
|
||||
help=_('List resource limits associated with project'),
|
||||
)
|
||||
return parser
|
||||
|
||||
def take_action(self, parsed_args):
|
||||
@ -131,11 +136,17 @@ class ListLimit(command.Lister):
|
||||
region = utils.find_resource(
|
||||
identity_client.regions, parsed_args.region
|
||||
)
|
||||
project = None
|
||||
if parsed_args.project:
|
||||
project = utils.find_resource(
|
||||
identity_client.projects, parsed_args.project
|
||||
)
|
||||
|
||||
limits = identity_client.limits.list(
|
||||
service=service,
|
||||
resource_name=parsed_args.resource_name,
|
||||
region=region
|
||||
region=region,
|
||||
project=project
|
||||
)
|
||||
|
||||
columns = (
|
||||
|
@ -362,7 +362,8 @@ class TestLimitList(TestLimit):
|
||||
columns, data = self.cmd.take_action(parsed_args)
|
||||
|
||||
self.limit_mock.list.assert_called_with(
|
||||
service=None, resource_name=None, region=None
|
||||
service=None, resource_name=None, region=None,
|
||||
project=None
|
||||
)
|
||||
|
||||
collist = (
|
||||
|
4
releasenotes/notes/bug-1798744-5512256baf4dc633.yaml
Normal file
4
releasenotes/notes/bug-1798744-5512256baf4dc633.yaml
Normal file
@ -0,0 +1,4 @@
|
||||
---
|
||||
features:
|
||||
- Add ``--project`` option to ``limit list`` command.
|
||||
[Bug `1798744 <https://bugs.launchpad.net/python-openstackclient/+bug/1798744>`_]
|
Loading…
Reference in New Issue
Block a user