On Wed, Dec 07, 2016 at 05:13:07PM +0100, Tomáš Golembiovský wrote:
Move the untar function so it can be used later in the code.
Signed-off-by: Tomáš Golembiovský <tgolembi(a)redhat.com>
---
v2v/input_ova.ml | 11 ++++++-----
1 file changed, 6 insertions(+), 5 deletions(-)
diff --git a/v2v/input_ova.ml b/v2v/input_ova.ml
index 61930f0..85954a3 100644
--- a/v2v/input_ova.ml
+++ b/v2v/input_ova.ml
@@ -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). *)
Simple code motion, so ACK.
Rich.
--
Richard Jones, Virtualization Group, Red Hat
http://people.redhat.com/~rjones
Read my programming and virtualization blog:
http://rwmj.wordpress.com
virt-builder quickly builds VMs from scratch
http://libguestfs.org/virt-builder.1.html