def _handle_parsing_error(func):
"""Decorator for handling errors in raw output data."""
@six.wraps(func)
def wrapper(raw_data):
msg = _('Data from Intel Node Manager %s')
try:
return func(raw_data)
except (IndexError, struct.error):
raise ironic_exception.IPMIFailure(msg % _('has wrong length.'))
except KeyError:
raise ironic_exception.IPMIFailure(msg % _('is corrupted.'))
except ValueError:
raise ironic_exception.IPMIFailure(msg % _('cannot be converted.'))
return wrapper
评论列表
文章目录