so, effectively, you want EphemeralIPv4Network to be idempotent I'm not sure how to ensure that within the current framework. - Correct, I'd like EphemeralIPv4Network to setup only what config it needs to and gracefully ignore any part of the configuration/state that already is active. But, this can/should be sorted in a separate branch than your current feature request.
As a followup to your initial suggested patch in IRC, I think we can do something like the following patch: - separate has_url_connectivity function (for ease of unit testing) which will attempt a GET on a given url. - EphemeralIPv4Network accepts optional connectivity_url to which it'll check has_url_connectivity return value http://paste.ubuntu.com/p/D7NyMtWhZ3/ We can sort what logic has_url_connectivity really needs to perform (maybe just using readurl?) based on use-cases. Most I would imagine would try to hit a metadata url, but maybe we want the facility to just ping an IP? We can grow that logic if we need to at a later time I suppose. - Chad On Thu, Nov 15, 2018 at 8:21 AM Igor Galić <[email protected]> wrote: > > On Mon, 12 Nov 2018, at 21:28, Chad Smith wrote: > > Minimally, I'd want cloud-init to fix the logic in EphemeralIPv4Network to > check each aspect of the requested network configuration separately: IP, > prefix/mask, broadcast, router IP and link status and ensure that all > desired aspects of configuration are correct. EphemeralIPv4Network should > not exit in success upon just seeing an IP address configured. > > > so, effectively, you want EphemeralIPv4Network to be *idempotent* > I'm not sure how to ensure that within the current framework. > > What do folks think about making the connectivity check an optional > parameter to EphemeralIPv4Network? > def __init__(self, interface, ip, prefix_or_mask, broadcast, router=None, > connectivity_url=None): > > If connectivity_url is set, EphemeralIPv4Network would check connectivity > to the connectivity_url, then EphemeralIPv4Network would perform some basic > connectivity check and noop if unnecessary. Otherwise, it would setup the > desired network configuration provided. > > > ➕💯 > > Can someone help me to take a the current cloudinit.net towards that > direction? > > > o/~ i > -- > Mailing list: https://launchpad.net/~cloud-init > Post to : [email protected] > Unsubscribe : https://launchpad.net/~cloud-init > More help : https://help.launchpad.net/ListHelp >
-- Mailing list: https://launchpad.net/~cloud-init Post to : [email protected] Unsubscribe : https://launchpad.net/~cloud-init More help : https://help.launchpad.net/ListHelp

