← Back to team overview

cloud-init-dev team mailing list archive

Re: [Merge] ~raharper/cloud-init:ubuntu-devel-new-artful-release-v7 into cloud-init:ubuntu/devel

 


Diff comments:

> diff --git a/cloudinit/net/eni.py b/cloudinit/net/eni.py
> index bb80ec0..c6a71d1 100644
> --- a/cloudinit/net/eni.py
> +++ b/cloudinit/net/eni.py
> @@ -95,6 +95,9 @@ def _iface_add_attrs(iface, index):
>          ignore_map.append('mac_address')
>  
>      for key, value in iface.items():
> +        # convert bool to string for eni
> +        if type(value) == bool:
> +            value = 'on' if iface[key] else 'off'

s/iface[key]/value/  since we already have it in this scope

>          if not value or key in ignore_map:
>              continue
>          if key in multiline_keys:
> diff --git a/cloudinit/net/network_state.py b/cloudinit/net/network_state.py
> index 6faf01b..890dbf8 100644
> --- a/cloudinit/net/network_state.py
> +++ b/cloudinit/net/network_state.py
> @@ -465,6 +466,18 @@ class NetworkStateInterpreter(object):
>          for param, val in command.get('params', {}).items():
>              iface.update({param: val})
>  
> +        # convert value to boolean
> +        bridge_stp = iface.get('bridge_stp')
> +        if bridge_stp and type(bridge_stp) != bool:

Won't this fail to match on brige_stp == 0?

> +            if bridge_stp in ['on', '1', 1]:
> +                bridge_stp = True
> +            elif bridge_stp in ['off', '0', 0]:
> +                bridge_stp = False
> +            else:
> +                raise ValueError("Cannot convert bridge_stp value"
> +                                 "(%s) to boolean", bridge_stp)
> +            iface.update({'bridge_stp': bridge_stp})
> +
>          interfaces.update({iface['name']: iface})
>  
>      @ensure_command_keys(['address'])


-- 
https://code.launchpad.net/~raharper/cloud-init/+git/cloud-init/+merge/331892
Your team cloud-init commiters is requested to review the proposed merge of ~raharper/cloud-init:ubuntu-devel-new-artful-release-v7 into cloud-init:ubuntu/devel.