diff options
Diffstat (limited to 'nova/utils.py')
-rw-r--r-- | nova/utils.py | 37 |
1 files changed, 0 insertions, 37 deletions
diff --git a/nova/utils.py b/nova/utils.py index 9067488d5..41d18b3cb 100644 --- a/nova/utils.py +++ b/nova/utils.py @@ -21,7 +21,6 @@ import contextlib import datetime -import errno import functools import hashlib import inspect @@ -439,18 +438,6 @@ def to_bytes(text, default=0): return default -def delete_if_exists(pathname): - """delete a file, but ignore file not found error.""" - - try: - os.unlink(pathname) - except OSError as e: - if e.errno == errno.ENOENT: - return - else: - raise - - def get_from_path(items, path): """Returns a list of items matching the specified path. @@ -733,18 +720,6 @@ def timefunc(func): return inner -@contextlib.contextmanager -def remove_path_on_error(path): - """Protect code that wants to operate on PATH atomically. - Any exception will cause PATH to be removed. - """ - try: - yield - except Exception: - with excutils.save_and_reraise_exception(): - delete_if_exists(path) - - def make_dev_path(dev, partition=None, base='/dev'): """Return a path to a particular device. @@ -803,18 +778,6 @@ def read_cached_file(filename, cache_info, reload_func=None): return cache_info['data'] -def file_open(*args, **kwargs): - """Open file - - see built-in file() documentation for more details - - Note: The reason this is kept in a separate module is to easily - be able to provide a stub module that doesn't alter system - state at all (for unit tests) - """ - return file(*args, **kwargs) - - def hash_file(file_like_object): """Generate a hash for the contents of a file.""" checksum = hashlib.sha1() |