|
|
@ -2859,10 +2859,18 @@ class DecortController(object):
|
|
|
|
return 0, None
|
|
|
|
return 0, None
|
|
|
|
elif name:
|
|
|
|
elif name:
|
|
|
|
if account_id:
|
|
|
|
if account_id:
|
|
|
|
api_params = dict(accountId=account_id,name=name)
|
|
|
|
api_params = {
|
|
|
|
|
|
|
|
'accountId': account_id,
|
|
|
|
|
|
|
|
'name': name,
|
|
|
|
|
|
|
|
'show_all': True
|
|
|
|
|
|
|
|
}
|
|
|
|
api_resp = self.decort_api_call(requests.post, "/restmachine/cloudapi/disks/search", api_params)
|
|
|
|
api_resp = self.decort_api_call(requests.post, "/restmachine/cloudapi/disks/search", api_params)
|
|
|
|
|
|
|
|
disks_list = api_resp.json()
|
|
|
|
|
|
|
|
# Filtering disks by status
|
|
|
|
|
|
|
|
excluded_statuses = ('PURGED', 'DESTROYED')
|
|
|
|
|
|
|
|
filter_f = lambda x: x.get('status') not in excluded_statuses
|
|
|
|
|
|
|
|
disks_list = [d for d in disks_list if filter_f(d)]
|
|
|
|
# the above call may return more than one matching disk
|
|
|
|
# the above call may return more than one matching disk
|
|
|
|
disks_list = json.loads(api_resp.content.decode('utf8'))
|
|
|
|
|
|
|
|
if len(disks_list) == 0:
|
|
|
|
if len(disks_list) == 0:
|
|
|
|
return 0, None
|
|
|
|
return 0, None
|
|
|
|
elif len(disks_list) > 1:
|
|
|
|
elif len(disks_list) > 1:
|
|
|
|