summaryrefslogtreecommitdiffstats
path: root/nova/utils.py
diff options
context:
space:
mode:
Diffstat (limited to 'nova/utils.py')
-rw-r--r--nova/utils.py37
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()