[PATCH] Don't traceback when no activated devices were found for ks network default (#956614)

Vratislav Podzimek vpodzime at redhat.com
Thu Apr 25 11:47:52 UTC 2013


On Thu, 2013-04-25 at 12:52 +0200, Radek Vykydal wrote:
> Typical crash case:
> specify network ks command with --hostname only.
> ---
>  pyanaconda/network.py | 7 +++++--
>  1 file changed, 5 insertions(+), 2 deletions(-)
> 
> diff --git a/pyanaconda/network.py b/pyanaconda/network.py
> index 577d3b0..42a9294 100644
> --- a/pyanaconda/network.py
> +++ b/pyanaconda/network.py
> @@ -810,7 +810,10 @@ def get_device_name(devspec):
>          elif nm.nm_is_connected():
>              # device activated in stage 1 by network kickstart command
>              msg = "first active device"
> -            devname = nm.nm_activated_devices()[0]
> +            try:
> +                devname = nm.nm_activated_devices()[0]
> +            except IndexError:
> +                log.debug("get_device_name: NM is connected but no activated devices found")
>          else:
>              msg = "first device found"
>              devname = min(devices)
> @@ -840,7 +843,7 @@ def get_device_name(devspec):
>                  log.error("Using --device=bootif without BOOTIF= boot option supplied")
>          else: devname = devspec
>  
> -    if devname not in devices:
> +    if devname and devname not in devices:
>          for d in devices:
>              try:
>                  hwaddr = nm.nm_device_hwaddress(d)
Looks good to me.

-- 
Vratislav Podzimek

Anaconda Rider | Red Hat, Inc. | Brno - Czech Republic



More information about the anaconda-patches mailing list