예제 #1
0
파일: engine.py 프로젝트: pombredanne/rally
 def make_cleanup(self):
     self.deployment.update_status(consts.DeployStatus.CLEANUP_STARTED)
     try:
         self.cleanup()
     except Exception:
         with excutils.save_and_reraise_exception():
             self.deployment.update_status(
                 consts.DeployStatus.CLEANUP_FAILED)
     else:
         self.deployment.update_status(consts.DeployStatus.CLEANUP_FINISHED)
예제 #2
0
def remove_path_on_error(path):
    """Protect code that wants to operate on PATH atomically.
    Any exception will cause PATH to be removed.

    :param path: File to work with
    """
    try:
        yield
    except Exception:
        with excutils.save_and_reraise_exception():
            delete_if_exists(path)
예제 #3
0
파일: engine.py 프로젝트: pombredanne/rally
 def make_deploy(self):
     self.deployment.update_status(consts.DeployStatus.DEPLOY_STARTED)
     try:
         endpoint = self.deploy()
     except Exception:
         with excutils.save_and_reraise_exception():
             self.deployment.update_status(
                 consts.DeployStatus.DEPLOY_FAILED)
     else:
         self.deployment.update_status(consts.DeployStatus.DEPLOY_FINISHED)
         return endpoint
예제 #4
0
파일: fileutils.py 프로젝트: sahanasj/rally
def remove_path_on_error(path, remove=delete_if_exists):
    """Protect code that wants to operate on PATH atomically.
    Any exception will cause PATH to be removed.

    :param path: File to work with
    :param remove: Optional function to remove passed path
    """

    try:
        yield
    except Exception:
        with excutils.save_and_reraise_exception():
            remove(path)