Remove unused methods
Manila doesn't use methods ensure_tree and delete_if_exists anywhere, and oslo.utils provides same methods in module fileutils. We can use them from oslo.utils if we need in the futrue. TrivialFix Change-Id: I280b674dca3738d26c2bed2cf71e94775b370cd5
This commit is contained in:
parent
e34d9f52ba
commit
e071dc0f26
@ -219,18 +219,6 @@ class LazyPluggable(object):
|
|||||||
return getattr(backend, key)
|
return getattr(backend, key)
|
||||||
|
|
||||||
|
|
||||||
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):
|
def get_from_path(items, path):
|
||||||
"""Returns a list of items matching the specified path.
|
"""Returns a list of items matching the specified path.
|
||||||
|
|
||||||
@ -476,21 +464,6 @@ def walk_class_hierarchy(clazz, encountered=None):
|
|||||||
yield subclass
|
yield subclass
|
||||||
|
|
||||||
|
|
||||||
def ensure_tree(path):
|
|
||||||
"""Create a directory (and any ancestor directories required)
|
|
||||||
|
|
||||||
:param path: Directory to create
|
|
||||||
"""
|
|
||||||
try:
|
|
||||||
os.makedirs(path)
|
|
||||||
except OSError as exc:
|
|
||||||
if exc.errno == errno.EEXIST:
|
|
||||||
if not os.path.isdir(path):
|
|
||||||
raise
|
|
||||||
else:
|
|
||||||
raise
|
|
||||||
|
|
||||||
|
|
||||||
def cidr_to_netmask(cidr):
|
def cidr_to_netmask(cidr):
|
||||||
"""Convert cidr to netmask."""
|
"""Convert cidr to netmask."""
|
||||||
try:
|
try:
|
||||||
|
Loading…
Reference in New Issue
Block a user