Here is a patch with some unit test cleanup  and unit test adds for the new 
function you added. 

I also adding a bit of checking on the url param passed to has_url_connectivity 
function since we don't want callsites to stuff in the wrong type of content.


Unit test adds and functionality changes below
http://paste.ubuntu.com/p/PQkjG6pHG8/


Diff comments:

> diff --git a/cloudinit/net/dhcp.py b/cloudinit/net/dhcp.py
> index bdc5799..0db991d 100644
> --- a/cloudinit/net/dhcp.py
> +++ b/cloudinit/net/dhcp.py
> @@ -86,6 +95,8 @@ class EphemeralDHCPv4(object):
>          kwargs = dict([(k, self.lease.get(v)) for k, v in nmap.items()])
>          if not kwargs['broadcast']:
>              kwargs['broadcast'] = bcip(kwargs['prefix_or_mask'], 
> kwargs['ip'])
> +        if self.connectivity_url:
> +            kwargs['connectivity_url'] = self.connectivity_url

Yes I think it is viable for use in DataSourceAzure:get_metadata_from_imds  
which does a blind net.is_up check on fallback nic. Instead that callsite could 
pass connectivity_url=IMDS_URL   or something to EphemeralDCHPv4

>          ephipv4 = EphemeralIPv4Network(**kwargs)
>          ephipv4.__enter__()
>          self._ephipv4 = ephipv4


-- 
https://code.launchpad.net/~i.galic/cloud-init/+git/cloud-init/+merge/358876
Your team cloud-init commiters is requested to review the proposed merge of 
~i.galic/cloud-init:feax/ephemeral_connectivity into cloud-init:master.

_______________________________________________
Mailing list: https://launchpad.net/~cloud-init-dev
Post to     : cloud-init-dev@lists.launchpad.net
Unsubscribe : https://launchpad.net/~cloud-init-dev
More help   : https://help.launchpad.net/ListHelp

Reply via email to