Merge "Use ClientPlugin.ignore_not_found as a context manager"

This commit is contained in:
Jenkins 2016-05-25 17:56:59 +00:00 committed by Gerrit Code Review
commit e5202ef454
2 changed files with 2 additions and 6 deletions

View File

@ -227,10 +227,8 @@ class SecurityGroup(neutron.NeutronResource):
else:
for rule in sec['security_group_rules']:
if to_delete is None or to_delete(rule):
try:
with self.client_plugin().ignore_not_found:
self.client().delete_security_group_rule(rule['id'])
except Exception as ex:
self.client_plugin().ignore_not_found(ex)
def handle_delete(self):
if self.resource_id is None:

View File

@ -111,10 +111,8 @@ class SaharaImageRegistry(resource.Resource):
if self.resource_id is None:
return
try:
with self.client_plugin().ignore_not_found:
self.client().images.unregister_image(self.resource_id)
except Exception as ex:
self.client_plugin().ignore_not_found(ex)
def resource_mapping():