# Path: virtman/openstack/common/excutils.py
# class save_and_reraise_exception(object):
#     def __init__(self):
#     def __enter__(self):
#     def __exit__(self, exc_type, exc_val, exc_tb):
# def forever_retry_uncaught_exceptions(infunc):
#     def inner_func(*args, **kwargs):


import contextlib
import errno
import os
import tempfile
from virtman.openstack.common import excutils
from virtman.openstack.common.gettextutils import _  # noqa
from virtman.openstack.common import log as logging
        reloaded = True
    return (reloaded, cache_info['data'])


def delete_if_exists(path, remove=os.unlink):
    """Delete a file, but ignore file not found error.

    :param path: File to delete
    :param remove: Optional function to remove passed path
    """

    try:
        remove(path)
    except OSError as e:
        if e.errno != errno.ENOENT:
            raise


@contextlib.contextmanager
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:

# Path: virtman/openstack/common/excutils.py
# class save_and_reraise_exception(object):
#     def __init__(self):
#     def __enter__(self):
#     def __exit__(self, exc_type, exc_val, exc_tb):
# def forever_retry_uncaught_exceptions(infunc):
#     def inner_func(*args, **kwargs):


# Path: virtman/openstack/common/fileutils.py
import contextlib
import errno
import os
import tempfile
from virtman.openstack.common import excutils
from virtman.openstack.common.gettextutils import _  # noqa
from virtman.openstack.common import log as logging

        reloaded = True
    return (reloaded, cache_info['data'])


def delete_if_exists(path, remove=os.unlink):
    """Delete a file, but ignore file not found error.

    :param path: File to delete
    :param remove: Optional function to remove passed path
    """

    try:
        remove(path)
    except OSError as e:
        if e.errno != errno.ENOENT:
            raise


@contextlib.contextmanager
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():