fix missing exceptions openstack modules (#48088)

* Fix missing exceptions (#45775)

* Replace non-existing OpenStackCloudTimeout exception. Fixes: #45151

* Replace OpenStackCloudURINotFound that doesn't exist in the 'exceptions' module

(cherry picked from commit eb39c461ce)

* add changelog
This commit is contained in:
Artem Goncharov 2018-11-05 18:36:57 +01:00 committed by Toshio Kuratomi
parent fb551bf62c
commit 953568e213
5 changed files with 7 additions and 5 deletions

View file

@ -0,0 +1,2 @@
bugfixes:
- replace renamed exceptions in multiple openstack modules

View file

@ -249,12 +249,12 @@ def _get_quotas(sdk, module, cloud, project):
quota = {}
try:
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.")
try:
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.")
quota['compute'] = _get_compute_quotas(cloud, project)

View file

@ -139,7 +139,7 @@ def main():
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))

View file

@ -124,7 +124,7 @@ def _absent_volume(module, cloud, sdk):
changed = cloud.delete_volume(name_or_id=module.params['display_name'],
wait=module.params['wait'],
timeout=module.params['timeout'])
except sdk.exceptions.OpenStackCloudTimeout:
except sdk.exceptions.ResourceTimeout:
module.exit_json(changed=changed)
module.exit_json(changed=changed)

View file

@ -186,7 +186,7 @@ def main():
module.fail_json(
msg="No volume with name or id '{0}' was found.".format(
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)