v2v: ova: move the untar function

Move the untar function so it can be used later in the code.

Signed-off-by: Tomáš Golembiovský <tgolembi@redhat.com>
This commit is contained in:
Tomáš Golembiovský
2016-12-18 23:16:30 +01:00
committed by Pino Toscano
parent 347e4b1648
commit 8644ea7242

View File

@@ -38,6 +38,12 @@ object
method as_options = "-i ova " ^ ova
method source () =
let untar ?(format = "") file outdir =
let cmd = [ "tar"; sprintf "-x%sf" format; file; "-C"; outdir ] in
if run_command cmd <> 0 then
error (f_"error unpacking %s, see earlier error messages") ova in
(* Extract ova file. *)
let exploded =
(* The spec allows a directory to be specified as an ova. This
@@ -61,11 +67,6 @@ object
tmpfile in
let untar ?(format = "") file outdir =
let cmd = [ "tar"; sprintf "-x%sf" format; file; "-C"; outdir ] in
if run_command cmd <> 0 then
error (f_"error unpacking %s, see earlier error messages") ova in
match detect_file_type ova with
| `Tar ->
(* Normal ovas are tar file (not compressed). *)