summaryrefslogtreecommitdiffstats
path: root/tools/__init__.py
diff options
context:
space:
mode:
Diffstat (limited to 'tools/__init__.py')
-rw-r--r--tools/__init__.py19
1 files changed, 19 insertions, 0 deletions
diff --git a/tools/__init__.py b/tools/__init__.py
index 374823f..126d1eb 100644
--- a/tools/__init__.py
+++ b/tools/__init__.py
@@ -60,6 +60,25 @@ def unmount(path):
@log
+def rm(path):
+ """Remove a file.
+
+ Args:
+ path (str): Path to file.
+
+ Returns:
+ True if the command was successful, False otherwise.
+ """
+ try:
+ os.remove(path)
+ except OSError as e:
+ L.error("failed to remove file %s: %r", path, e)
+ return False
+
+ return True
+
+
+@log
def rmdir(path):
"""Remove a directory.