def OrFail(description=None):
  """Make failure non-fatal and improve reporting."""
  def wrapper(f):
    @functools.wraps(f)
    def wrapped(self):
      safety = copy.deepcopy(self.config_data)
      try:
        f(self)
      except BaseException, e:
        msg = "%s failed:\n%s" % (description or f.func_name, e)
        logging.exception(msg)
        self.config_data = safety
        self.errors.append(msg)
    return wrapped
  return wrapper
dataset/ETHPy150Open ganeti/ganeti/lib/tools/cfgupgrade.py/OrFail/original