Make trust manager raise formatted message exception
Keystone Exception doesn't support the following use: raise exception.Forbidden(_('%(xx)d %(yy)d]'), xx=1, yy=2) This can lead to a bug that we will get a unformatted message when error happens. Change-Id: I8a9d4b61eaed8575fe1473ccf5d54a4efe752f21 Closes-Bug: #1413905
This commit is contained in:
parent
363117d9a6
commit
0bdde48eee
|
@ -55,9 +55,9 @@ class Manager(manager.Manager):
|
|||
if not (0 < redelegation_depth <= max_redelegation_count):
|
||||
raise exception.Forbidden(
|
||||
_('Remaining redelegation depth of %(redelegation_depth)d'
|
||||
' out of allowed range of [0..%(max_count)d]'),
|
||||
redelegation_depth=redelegation_depth,
|
||||
max_count=max_redelegation_count)
|
||||
' out of allowed range of [0..%(max_count)d]') %
|
||||
{'redelegation_depth': redelegation_depth,
|
||||
'max_count': max_redelegation_count})
|
||||
|
||||
# remaining_uses is None
|
||||
remaining_uses = trust.get('remaining_uses')
|
||||
|
@ -139,9 +139,9 @@ class Manager(manager.Manager):
|
|||
if requested_count and requested_count > max_redelegation_count:
|
||||
raise exception.Forbidden(
|
||||
_('Requested redelegation depth of %(requested_count)d '
|
||||
'is greater than allowed %(max_count)d'),
|
||||
requested_count=requested_count,
|
||||
max_count=max_redelegation_count)
|
||||
'is greater than allowed %(max_count)d') %
|
||||
{'requested_count': requested_count,
|
||||
'max_count': max_redelegation_count})
|
||||
# Decline remaining_uses
|
||||
if 'remaining_uses' in trust:
|
||||
exception.ValidationError(_('remaining_uses must not be set '
|
||||
|
|
Loading…
Reference in New Issue