Diff comments:
> diff --git a/cloudinit/sources/DataSourceEc2.py > b/cloudinit/sources/DataSourceEc2.py > index 4ec9592..ae0fe26 100644 > --- a/cloudinit/sources/DataSourceEc2.py > +++ b/cloudinit/sources/DataSourceEc2.py > @@ -73,21 +77,25 @@ class DataSourceEc2(sources.DataSource): > elif self.cloud_platform == Platforms.NO_EC2_METADATA: > return False > > - try: > - if not self.wait_for_metadata_service(): > + if self.get_network_metadata: # Setup networking in init-local > stage. > + if util.is_FreeBSD(): > + LOG.debug("FreeBSD doesn't support running dhclient with > -sf") But, I'd like to leave the writing of dhclient.conf out of this branch and tackle BSD another time if we could postpone it. > return False > - start_time = time.time() > - self.userdata_raw = \ > - ec2.get_instance_userdata(self.api_ver, > self.metadata_address) > - self.metadata = ec2.get_instance_metadata(self.api_ver, > - self.metadata_address) > - LOG.debug("Crawl of metadata service took %.3f seconds", > - time.time() - start_time) > - return True > - except Exception: > - util.logexc(LOG, "Failed reading from metadata address %s", > - self.metadata_address) > - return False > + dhcp_leases = dhcp.maybe_dhcp_clean_discovery() > + if not dhcp_leases: > + # DataSourceEc2Local failed in init-local stage. > DataSourceEc2 > + # will still run in init-network stage. > + return False > + dhcp_opts = dhcp_leases[-1] > + net_params = {'interface': dhcp_opts.get('interface'), > + 'ip': dhcp_opts.get('fixed-address'), > + 'prefix_or_mask': dhcp_opts.get('subnet-mask'), > + 'broadcast': dhcp_opts.get('broadcast-address'), > + 'router': dhcp_opts.get('routers')} > + with net.EphemeralIPv4Network(**net_params): > + return self._crawl_metadata() > + else: > + return self._crawl_metadata() > > @property > def launch_index(self): -- 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. _______________________________________________ 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