[PATCH] fix crash with bare 'inst.virtiolog' in boot args

Brian C. Lane bcl at redhat.com
Mon Mar 16 16:03:42 UTC 2015


On Mon, Mar 16, 2015 at 11:50:42AM -0400, Will Woods wrote:
> For most boot arguments (e.g. "inst.ks=/some/path"), we'll have
> `flags.cmdline[ks] == "/some/path"`.
> 
> For *bare* boot arguments, the value will be None.
> 
> So, if you do:
> 
>     vport = flags.cmdline.get("virtiolog", self.VIRTIO_PORT)
> 
> but the boot args have a bare 'inst.virtiolog', vport will be None
> instead of self.VIRTIO_PORT.
> 
> So: just do a plain get(), and if the result is None or an empty string,
> use self.VIRTIO_PORT instead.
> ---
>  pyanaconda/anaconda_log.py | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/pyanaconda/anaconda_log.py b/pyanaconda/anaconda_log.py
> index 3e8d70b..7012167 100644
> --- a/pyanaconda/anaconda_log.py
> +++ b/pyanaconda/anaconda_log.py
> @@ -236,7 +236,7 @@ class AnacondaLog:
>          """
>          TEMPLATE = "*.* %s;anaconda_syslog\n"
>  
> -        vport = flags.cmdline.get('virtiolog', self.VIRTIO_PORT)
> +        vport = flags.cmdline.get('virtiolog') or self.VIRTIO_PORT
>  
>          if not os.access(vport, os.W_OK):
>              return
> -- 
> 2.1.0

Ack

-- 
Brian C. Lane | Anaconda Team | IRC: bcl #anaconda | Port Orchard, WA (PST8PDT)


More information about the anaconda-patches mailing list