Richard W.M. Jones
2016-Jun-13 10:33 UTC
[Libguestfs] [PATCH] customize: Give an error if --truncate-recursive path does not exist (RHBZ#1345809).
You will now see an error such as: $ virt-customize -a centos-6.img --truncate-recursive /home/foo [ 0.0] Examining the guest ... [ 16.5] Setting a random seed [ 16.5] Recursively truncating: /home/foo virt-customize: error: libguestfs error: find0: /home/foo: No such file or directory Thanks: Xianghua Chen --- mllib/common_utils.ml | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/mllib/common_utils.ml b/mllib/common_utils.ml index dfffae3..9765a79 100644 --- a/mllib/common_utils.ml +++ b/mllib/common_utils.ml @@ -779,12 +779,10 @@ let rm_rf_only_files (g : Guestfs.guestfs) ?filter dir ) let truncate_recursive (g : Guestfs.guestfs) dir - if g#is_dir dir then ( - let files = Array.map (Filename.concat dir) (g#find dir) in - let files = Array.to_list files in - let files = List.filter g#is_file files in - List.iter g#truncate files - ) + let files = Array.map (Filename.concat dir) (g#find dir) in + let files = Array.to_list files in + let files = List.filter g#is_file files in + List.iter g#truncate files (* Detect type of a file. *) let detect_file_type filename -- 2.7.4
Pino Toscano
2016-Jun-13 12:15 UTC
Re: [Libguestfs] [PATCH] customize: Give an error if --truncate-recursive path does not exist (RHBZ#1345809).
On Monday 13 June 2016 11:33:23 Richard W.M. Jones wrote:> You will now see an error such as: > > $ virt-customize -a centos-6.img --truncate-recursive /home/foo > [ 0.0] Examining the guest ... > [ 16.5] Setting a random seed > [ 16.5] Recursively truncating: /home/foo > virt-customize: error: libguestfs error: find0: /home/foo: No such file or > directory > > Thanks: Xianghua Chen > ---LGTM. Thanks, -- Pino Toscano
Apparently Analagous Threads
- [PATCH v2] customize: add --truncate-recursive option
- [PATCH 1/3] mllib: add an optional filter for rm_rf_only_files
- [PATCH v2] customize: add --truncate-recursive option
- Re: [PATCH] customize: add --truncate-recursive option
- [PATCH 3/3] sysprep: rework and fix cron-spool operation (RHBZ#1229305)