summaryrefslogtreecommitdiffstats
path: root/generator
diff options
context:
space:
mode:
authorRichard W.M. Jones <rjones@redhat.com>2012-09-17 16:25:53 +0100
committerRichard W.M. Jones <rjones@redhat.com>2012-09-17 16:25:53 +0100
commita2dc3dbad0b9e6ee827247ee3ceefca480f5a052 (patch)
treeae15d6bb0e78abdcc76d6e3b2ccfe82d94df5b0b /generator
parent74283d58cfb62e6cc73bfe0f62ca142ddc1e8fb2 (diff)
downloadlibguestfs-a2dc3dbad0b9e6ee827247ee3ceefca480f5a052.tar.gz
libguestfs-a2dc3dbad0b9e6ee827247ee3ceefca480f5a052.tar.xz
libguestfs-a2dc3dbad0b9e6ee827247ee3ceefca480f5a052.zip
New API: rm-f: remove a file, ignoring errors if it doesn't exist.
Diffstat (limited to 'generator')
-rw-r--r--generator/actions.ml27
1 files changed, 27 insertions, 0 deletions
diff --git a/generator/actions.ml b/generator/actions.ml
index 16b1518c..a17fed0d 100644
--- a/generator/actions.ml
+++ b/generator/actions.ml
@@ -9802,6 +9802,33 @@ the resulting filesystem may be inconsistent or corrupt.
The returned status indicates whether filesystem corruption was
detected (returns C<1>) or was not detected (returns C<0>)." };
+ { defaults with
+ name = "rm_f";
+ style = RErr, [Pathname "path"], [];
+ proc_nr = Some 367;
+ tests = [
+ InitScratchFS, Always, TestOutputFalse
+ [["mkdir"; "/rm_f"];
+ ["touch"; "/rm_f/foo"];
+ ["rm_f"; "/rm_f/foo"];
+ ["rm_f"; "/rm_f/not_exists"];
+ ["exists"; "/rm_f/foo"]];
+ InitScratchFS, Always, TestLastFail
+ [["mkdir"; "/rm_f2"];
+ ["mkdir"; "/rm_f2/foo"];
+ ["rm_f"; "/rm_f2/foo"]]
+ ];
+ shortdesc = "remove a file ignoring errors";
+ longdesc = "\
+Remove the file C<path>.
+
+If the file doesn't exist, that error is ignored. (Other errors,
+eg. I/O errors or bad paths, are not ignored)
+
+This call cannot remove directories.
+Use C<guestfs_rmdir> to remove an empty directory,
+or C<guestfs_rm_rf> to remove directories recursively." };
+
]
(* Non-API meta-commands available only in guestfish.