[et-mgmt-tools] [PATCH] don't fail if virt-viewer is missing

Cole Robinson crobinso at redhat.com
Wed Dec 19 17:35:27 UTC 2007


Guido Guenther wrote:
> diff --git a/virt-install b/virt-install
> index 995f2c3..1215420 100755
> --- a/virt-install
> +++ b/virt-install
> @@ -15,6 +15,7 @@
>  
>  
>  import os, sys, string
> +import errno
>  from optparse import OptionParser, OptionValueError
>  import subprocess
>  import logging
> @@ -311,7 +312,15 @@ def vnc_console(dom, uri):
>      args = args + [ "--wait", "%s" % dom.ID()]
>      child = os.fork()
>      if not child:
> -        os.execvp(args[0], args)
> +        try:
> +            os.execvp(args[0], args)
> +        except OSError, (err, msg):
> +            if err == errno.ENOENT:
> +                print _("virt-viewer not found, please install the 'virt-viewer' package")
> +            else: 
> +                raise OSError, (err, msg)
> +        except e:
> +            raise
>          os._exit(1)
>  
>      return child
> 
> --UlVJffcvxoiEqYs2--
> 

I committed this with, with a small change to the error message. Thanks!

http://hg.et.redhat.com/virt/applications/virtinst--devel?cs=e5476eeb19e4

- Cole




More information about the et-mgmt-tools mailing list