[virt-tools-list] [virt-manager PATCH v2] formats: make sure 'unar' is existed

Chen Hanxiao chenhanxiao at cn.fujitsu.com
Thu Mar 6 01:24:59 UTC 2014



> -----Original Message-----
> From: Cole Robinson [mailto:crobinso at redhat.com]
> Sent: Wednesday, March 05, 2014 9:05 PM
> To: Chen Hanxiao; virt-tools-list at redhat.com
> Subject: Re: [virt-tools-list] [virt-manager PATCH v2] formats: make sure
'unar' is
> existed
> 
> On 03/04/2014 09:49 PM, Chen Hanxiao wrote:
> > Commit 0b4a72fd77f74e5a9f6885179febe601156df617
> > 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 at cn.fujitsu.com>
> > ---
> > v2: use find_executable function and impove error message.
> >
> >  virtconv/formats.py | 9 +++++++++
> >  1 file changed, 9 insertions(+)
> >
> > diff --git a/virtconv/formats.py b/virtconv/formats.py
> > index 5eb4356..0663190 100644
> > --- a/virtconv/formats.py
> > +++ b/virtconv/formats.py
> > @@ -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)))
> >
> 
> ACK
> 
> - Cole

Thanks, pushed.





More information about the virt-tools-list mailing list