formats: make sure 'unar' is existed
Commit 0b4a72fd77
need unar command to do something.
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@cn.fujitsu.com>
This commit is contained in:
parent
7dfdbb3f35
commit
98a27fc7fd
|
@ -132,6 +132,15 @@ 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.
|
||||
if not find_executable("unar"):
|
||||
raise RuntimeError(_("%s appears to be an archive, "
|
||||
"but 'unar' is not installed. "
|
||||
"Please either install 'unar', or extract the archive "
|
||||
"yourself and point virt-convert at "
|
||||
"the extracted directory.") % base)
|
||||
|
||||
cmd = ["unar", "-o", tempdir, base]
|
||||
print_cb(_("%s appears to be an archive, running: %s") %
|
||||
(base, " ".join(cmd)))
|
||||
|
|
Loading…
Reference in New Issue