Merge "Use kwargs for ResourcePropertyConflict exception"
This commit is contained in:
commit
5e940450e0
@ -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):
|
||||
|
@ -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):
|
||||
|
@ -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
|
||||
|
Loading…
x
Reference in New Issue
Block a user