diff options
author | Scott Moser <smoser@ubuntu.com> | 2016-03-24 17:11:26 -0400 |
---|---|---|
committer | Scott Moser <smoser@ubuntu.com> | 2016-03-24 17:11:26 -0400 |
commit | 6c49afad6134c5094c5e21784e76735faf510a29 (patch) | |
tree | f3c6913c9a97268fa9500278ced0d6ac3ecd7626 /cloudinit | |
parent | e2536e758f22bbce9e1fc49a319738f2c3296930 (diff) | |
download | vyos-cloud-init-6c49afad6134c5094c5e21784e76735faf510a29.tar.gz vyos-cloud-init-6c49afad6134c5094c5e21784e76735faf510a29.zip |
some final changes
a.) do not write systemd link files if we do not have a mac address.
the check is updated to check for value rather than just presense
(ie, 'mac_address': None)
b.) DataSourceNoCloudNet: search in the nocloud seed dir
this is important because NoCloud if dsmode is Net will look only
would pass by, expecting NoCloudNet to pick it up
but NoCloudNet would not look in /var/lib/cloud/seed/nocloud
and thus skip it.
c.) support the disabling of network configuration
via /var/lib/cloud/data/upgraded-network
This is what the package upgrader is writing.
Diffstat (limited to 'cloudinit')
-rw-r--r-- | cloudinit/net/__init__.py | 4 | ||||
-rw-r--r-- | cloudinit/sources/DataSourceNoCloud.py | 1 | ||||
-rw-r--r-- | cloudinit/stages.py | 5 |
3 files changed, 7 insertions, 3 deletions
diff --git a/cloudinit/net/__init__.py b/cloudinit/net/__init__.py index 57beb837..40929c6e 100644 --- a/cloudinit/net/__init__.py +++ b/cloudinit/net/__init__.py @@ -407,7 +407,7 @@ def render_persistent_net(network_state): for iface in interfaces.values(): # for physical interfaces write out a persist net udev rule if iface['type'] == 'physical' and \ - 'name' in iface and 'mac_address' in iface: + 'name' in iface and iface.get('mac_address'): content += generate_udev_rule(iface['name'], iface['mac_address']) @@ -598,7 +598,7 @@ def render_systemd_links(target, network_state, interfaces = network_state.get('interfaces') for iface in interfaces.values(): if (iface['type'] == 'physical' and 'name' in iface and - 'mac_address' in iface): + iface.get('mac_address')): fname = fp_prefix + iface['name'] + ".link" with open(fname, "w") as fp: fp.write("\n".join([ diff --git a/cloudinit/sources/DataSourceNoCloud.py b/cloudinit/sources/DataSourceNoCloud.py index 802d515b..c2fba4d2 100644 --- a/cloudinit/sources/DataSourceNoCloud.py +++ b/cloudinit/sources/DataSourceNoCloud.py @@ -316,7 +316,6 @@ class DataSourceNoCloudNet(DataSourceNoCloud): DataSourceNoCloud.__init__(self, sys_cfg, distro, paths) self.cmdline_id = "ds=nocloud-net" self.supported_seed_starts = ("http://", "https://", "ftp://") - self.seed_dirs = [os.path.join(paths.seed_dir, 'nocloud-net')] self.dsmode = "net" diff --git a/cloudinit/stages.py b/cloudinit/stages.py index 5d6b0447..143a4fc9 100644 --- a/cloudinit/stages.py +++ b/cloudinit/stages.py @@ -570,6 +570,11 @@ class Init(object): self._do_handlers(user_data_msg, c_handlers_list, frequency) def _find_networking_config(self): + disable_file = os.path.join( + self.paths.get_cpath('data'), 'upgraded-network') + if os.path.exists(disable_file): + return (None, disable_file) + cmdline_cfg = ('cmdline', net.read_kernel_cmdline_config()) dscfg = ('ds', None) if self.datasource and hasattr(self.datasource, 'network_config'): |