[PATCH master] network: do not crash when device for network --device is not found (#1023829)

Chris Lumens clumens at redhat.com
Mon Nov 4 15:25:21 UTC 2013


> diff --git a/pyanaconda/network.py b/pyanaconda/network.py
> index 2026ce2..0cb9dcb 100644
> --- a/pyanaconda/network.py
> +++ b/pyanaconda/network.py
> @@ -1082,7 +1082,7 @@ def setOnboot(ksdata):
>          else:
>              devname = get_device_name(network_data.device)
>              if not devname:
> -                log.warning("Kickstart: The provided network interface %s does not exist" % network_data.device)
> +                log.warning("network: set ONBOOT: --device %s does not exist" % network_data.device)
>                  continue
>  
>          updated_devices.append(devname)
> @@ -1103,8 +1103,11 @@ def apply_kickstart_from_pre_section(ksdata):
>  
>          # get device name for device specified by MAC, link, bootif, etc...
>          dev_name = ks_spec_to_device_name(network_data.device)
> -        if not dev_name:
> -            log.error("Kickstart: The provided network interface %s does not exist" % network_data.device)
> +        if (not dev_name
> +            or (dev_name not in nm.nm_devices()
> +                and not network_data.vlanid
> +                and not network_data.bondslaves)):
> +            log.error("network: pre kickstart: --device %s does not exist" % network_data.device)
>              continue
>  
>          if network_data.vlanid:

pylint will complain about using % in the log messages.

- Chris


More information about the anaconda-patches mailing list