[virt-tools-list] [virt-manager PATCH] formats: make sure 'unar' is existed
Chen Hanxiao
chenhanxiao at cn.fujitsu.com
Tue Mar 4 08:16:58 UTC 2014
Commit 0b4a72fd77f74e5a9f6885179febe601156df617
needs unar command to do some tests.
But if we haven't installed it, the error message
told us nothing valuable as:
"OSError: [Errno 2] No such file or directory"
This patch will impove the error message.
Signed-off-by: Chen Hanxiao <chenhanxiao at cn.fujitsu.com>
---
virtconv/formats.py | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/virtconv/formats.py b/virtconv/formats.py
index 5eb4356..2602c09 100644
--- a/virtconv/formats.py
+++ b/virtconv/formats.py
@@ -132,6 +132,12 @@ def _find_input(input_file, parser, print_cb):
prefix="virt-convert-tmp", dir=basedir)
base = os.path.basename(input_file)
+
+ # check if 'unar' command existed.
+ ret = os.system("unar -h > /dev/null")
+ if ret:
+ raise RuntimeError("Could not find 'unar' command")
+
cmd = ["unar", "-o", tempdir, base]
print_cb(_("%s appears to be an archive, running: %s") %
(base, " ".join(cmd)))
--
1.8.5.3
More information about the virt-tools-list
mailing list