Skip to content

Commit

Permalink
Refactor UpdateReplace exception
Browse files Browse the repository at this point in the history
Use six.text_type to format error message, so that we can avoid
possible failure in unittest when switching to oslo.i18n.

Change-Id: I6979a3298ff5c3dac734bd7ad5534853bab1a7d8
  • Loading branch information
Ethan Lynn committed Aug 4, 2014
1 parent 377da55 commit ab2ccd7
Showing 1 changed file with 4 additions and 11 deletions.
15 changes: 4 additions & 11 deletions heat/engine/resource.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,17 +52,10 @@ def _register_class(resource_type, resource_class):


class UpdateReplace(Exception):
'''
Raised when resource update requires replacement
'''

def __init__(self, resource_name='Unknown',
message=_("The Resource %s requires replacement.")):
try:
msg = message % resource_name
except TypeError:
msg = message
super(Exception, self).__init__(msg)
'''Raised when resource update requires replacement.'''
def __init__(self, resource_name='Unknown'):
msg = _("The Resource %s requires replacement.") % resource_name
super(Exception, self).__init__(six.text_type(msg))


class ResourceInError(exception.HeatException):
Expand Down

0 comments on commit ab2ccd7

Please sign in to comment.