Merge "Use kwargs for ResourcePropertyConflict exception"

This commit is contained in:
Jenkins 2014-12-10 10:08:50 +00:00 committed by Gerrit Code Review
commit 5e940450e0
3 changed files with 8 additions and 5 deletions

View File

@ -85,6 +85,7 @@ class FaultWrapper(wsgi.Middleware):
'RequestLimitExceeded': webob.exc.HTTPBadRequest,
'InvalidTemplateParameter': webob.exc.HTTPBadRequest,
'Invalid': webob.exc.HTTPBadRequest,
'ResourcePropertyConflict': webob.exc.HTTPBadRequest,
}
def _map_exception_to_error(self, class_exception):

View File

@ -314,11 +314,13 @@ class ResourceActionNotSupported(HeatException):
class ResourcePropertyConflict(HeatException):
msg_fmt = _('Cannot define the following properties at the same time: %s.')
msg_fmt = _('Cannot define the following properties '
'at the same time: %(props)s.')
def __init__(self, *args):
self.msg_fmt = self.msg_fmt % ", ".join(args)
super(ResourcePropertyConflict, self).__init__()
def __init__(self, *args, **kwargs):
if args:
kwargs.update({'props': ", ".join(args)})
super(ResourcePropertyConflict, self).__init__(**kwargs)
class HTTPExceptionDisguise(Exception):

View File

@ -225,7 +225,7 @@ class RouterInterface(neutron.NeutronResource):
subnet_id_value = properties.get(depr_subnet_key)
if subnet_value and subnet_id_value:
raise exception.ResourcePropertyConflict(subnet_key,
subnet_key)
depr_subnet_key)
if not subnet_value and not subnet_id_value:
return False
return True