← Back to team overview

cloud-init-dev team mailing list archive

Re: [Merge] ~chad.smith/cloud-init:aws-local-dhcp into cloud-init:master

 


Diff comments:

> diff --git a/cloudinit/net/__init__.py b/cloudinit/net/__init__.py
> index 46cb9c8..d38ea8b 100644
> --- a/cloudinit/net/__init__.py
> +++ b/cloudinit/net/__init__.py
> @@ -233,15 +231,24 @@ def generate_fallback_config(blacklist_drivers=None, config_driver=None):
>      if DEFAULT_PRIMARY_INTERFACE in names:
>          names.remove(DEFAULT_PRIMARY_INTERFACE)
>          names.insert(0, DEFAULT_PRIMARY_INTERFACE)
> -    target_name = None
> -    target_mac = None
> +
> +    # pick the first that has a address

Updated the comment here. this is a mac-address we are looking at no an ip address, so we aren't looking for the first nic that is "up" we are looking for the first nic with a configured mac address.

>      for name in names:
> -        mac = read_sys_net_safe(name, 'address')
> -        if mac:
> -            target_name = name
> -            target_mac = mac
> -            break
> -    if target_mac and target_name:
> +        if read_sys_net_safe(name, 'address'):
> +            return name
> +    return None
> +
> +
> +def generate_fallback_config(blacklist_drivers=None, config_driver=None):
> +    """Determine which attached net dev is most likely to have a connection and
> +       generate network state to run dhcp on that interface"""
> +
> +    if not config_driver:
> +        config_driver = False
> +
> +    target_name = find_fallback_nic(blacklist_drivers=blacklist_drivers)
> +    if target_name:
> +        target_mac = read_sys_net_safe(target_name, 'address')
>          nconf = {'config': [], 'version': 1}
>          cfg = {'type': 'physical', 'name': target_name,
>                 'mac_address': target_mac, 'subnets': [{'type': 'dhcp'}]}


-- 
https://code.launchpad.net/~chad.smith/cloud-init/+git/cloud-init/+merge/328241
Your team cloud-init commiters is requested to review the proposed merge of ~chad.smith/cloud-init:aws-local-dhcp into cloud-init:master.