mirror of
https://github.com/ansible-collections/community.general.git
synced 2026-05-08 06:12:51 +00:00
Fix missing exceptions (#45775)
* Replace non-existing OpenStackCloudTimeout exception. Fixes: #45151 * Replace OpenStackCloudURINotFound that doesn't exist in the 'exceptions' module
This commit is contained in:
@@ -249,12 +249,12 @@ def _get_quotas(sdk, module, cloud, project):
|
|||||||
quota = {}
|
quota = {}
|
||||||
try:
|
try:
|
||||||
quota['volume'] = _get_volume_quotas(cloud, project)
|
quota['volume'] = _get_volume_quotas(cloud, project)
|
||||||
except sdk.exceptions.OpenStackCloudURINotFound:
|
except sdk.exceptions.NotFoundException:
|
||||||
module.warn("No public endpoint for volumev2 service was found. Ignoring volume quotas.")
|
module.warn("No public endpoint for volumev2 service was found. Ignoring volume quotas.")
|
||||||
|
|
||||||
try:
|
try:
|
||||||
quota['network'] = _get_network_quotas(cloud, project)
|
quota['network'] = _get_network_quotas(cloud, project)
|
||||||
except sdk.exceptions.OpenStackCloudURINotFound:
|
except sdk.exceptions.NotFoundException:
|
||||||
module.warn("No public endpoint for network service was found. Ignoring network quotas.")
|
module.warn("No public endpoint for network service was found. Ignoring network quotas.")
|
||||||
|
|
||||||
quota['compute'] = _get_compute_quotas(cloud, project)
|
quota['compute'] = _get_compute_quotas(cloud, project)
|
||||||
|
|||||||
@@ -139,7 +139,7 @@ def main():
|
|||||||
result='Detached volume from server'
|
result='Detached volume from server'
|
||||||
)
|
)
|
||||||
|
|
||||||
except (sdk.exceptions.OpenStackCloudException, sdk.exceptions.OpenStackCloudTimeout) as e:
|
except (sdk.exceptions.OpenStackCloudException, sdk.exceptions.ResourceTimeout) as e:
|
||||||
module.fail_json(msg=str(e))
|
module.fail_json(msg=str(e))
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -124,7 +124,7 @@ def _absent_volume(module, cloud, sdk):
|
|||||||
changed = cloud.delete_volume(name_or_id=module.params['display_name'],
|
changed = cloud.delete_volume(name_or_id=module.params['display_name'],
|
||||||
wait=module.params['wait'],
|
wait=module.params['wait'],
|
||||||
timeout=module.params['timeout'])
|
timeout=module.params['timeout'])
|
||||||
except sdk.exceptions.OpenStackCloudTimeout:
|
except sdk.exceptions.ResourceTimeout:
|
||||||
module.exit_json(changed=changed)
|
module.exit_json(changed=changed)
|
||||||
|
|
||||||
module.exit_json(changed=changed)
|
module.exit_json(changed=changed)
|
||||||
|
|||||||
@@ -170,7 +170,7 @@ def main():
|
|||||||
module.fail_json(
|
module.fail_json(
|
||||||
msg="No volume with name or id '{0}' was found.".format(
|
msg="No volume with name or id '{0}' was found.".format(
|
||||||
module.params['volume']))
|
module.params['volume']))
|
||||||
except (sdk.exceptions.OpenStackCloudException, sdk.exceptions.OpenStackCloudTimeout) as e:
|
except (sdk.exceptions.OpenStackCloudException, sdk.exceptions.ResourceTimeout) as e:
|
||||||
module.fail_json(msg=e.message)
|
module.fail_json(msg=e.message)
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user