Add the argument disk_type validation in the method DecortController.account_disks
This commit is contained in:
@@ -141,7 +141,7 @@ class DecortAccountInfo(DecortController):
|
|||||||
),
|
),
|
||||||
type=dict(
|
type=dict(
|
||||||
type='str',
|
type='str',
|
||||||
choices=['B', 'D'],
|
choices=self.DISK_TYPES,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
|||||||
@@ -121,6 +121,8 @@ class DecortController(object):
|
|||||||
'STOPPING',
|
'STOPPING',
|
||||||
]
|
]
|
||||||
|
|
||||||
|
DISK_TYPES = ['B', 'D']
|
||||||
|
|
||||||
RESOURCE_GROUP_STATUSES = [
|
RESOURCE_GROUP_STATUSES = [
|
||||||
'CREATED',
|
'CREATED',
|
||||||
'DELETED',
|
'DELETED',
|
||||||
@@ -2448,6 +2450,15 @@ class DecortController(object):
|
|||||||
`/cloudapi/account/listDisks`.
|
`/cloudapi/account/listDisks`.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
if disk_type and (
|
||||||
|
not disk_type in self.DISK_TYPES
|
||||||
|
):
|
||||||
|
self.result['msg'] = (
|
||||||
|
f'{disk_type} is not valid disk type'
|
||||||
|
f' for filtering account disk list.'
|
||||||
|
)
|
||||||
|
self.amodule.fail_json(**self.result)
|
||||||
|
|
||||||
sort_by = None
|
sort_by = None
|
||||||
if sort_by_field:
|
if sort_by_field:
|
||||||
if not sort_by_field in self.FIELDS_FOR_SORTING_ACCOUNT_DISK_LIST:
|
if not sort_by_field in self.FIELDS_FOR_SORTING_ACCOUNT_DISK_LIST:
|
||||||
|
|||||||
Reference in New Issue
Block a user