diff options
author | Jenkins <jenkins@review.openstack.org> | 2013-06-15 22:15:54 +0000 |
---|---|---|
committer | Gerrit Code Review <review@openstack.org> | 2013-06-15 22:15:54 +0000 |
commit | 093c2aa5fec76099d15331277c6a4a887e807891 (patch) | |
tree | 0b2916ba7d948357030ad3d0c50c9dbcc0a9c367 /nova/utils.py | |
parent | 32aa8cc6387119adf3bc813401073fb8d0a8042f (diff) | |
parent | ab1977af316eef5375c7aaefdf364548b4fb5289 (diff) | |
download | nova-093c2aa5fec76099d15331277c6a4a887e807891.tar.gz nova-093c2aa5fec76099d15331277c6a4a887e807891.tar.xz nova-093c2aa5fec76099d15331277c6a4a887e807891.zip |
Merge "Replace functions in utils with oslo.fileutils"
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 338e4d880..fe360cac6 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 @@ -440,18 +439,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. @@ -739,18 +726,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. @@ -809,18 +784,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() |