diff options
| author | Scott Moser <smoser@ubuntu.com> | 2016-03-24 17:30:57 -0400 |
|---|---|---|
| committer | Scott Moser <smoser@ubuntu.com> | 2016-03-24 17:30:57 -0400 |
| commit | 18bf614ca1d9fbabdf83495e7675a2cacaf6c2f4 (patch) | |
| tree | de2352926ea476abcafcdb14790ea21958973db9 /cloudinit/distros/__init__.py | |
| parent | 4f2065ad569355d5d0bc54176bde6b8e55047341 (diff) | |
| parent | 20cc8113dde9e6849e8a692aea64cf81a266406d (diff) | |
| download | vyos-cloud-init-18bf614ca1d9fbabdf83495e7675a2cacaf6c2f4.tar.gz vyos-cloud-init-18bf614ca1d9fbabdf83495e7675a2cacaf6c2f4.zip | |
support network configuration in cloud-init --local
this allows 'cloud-init --local' to fully run before networking comes up.
By doing so, we can now cleanly apply networking to the new system.
This adds support for reading ConfigDrive network configuration
and also from NoCloud. The support is only present for ubuntu/debian
at the current time. Other distros will follow.
Also ability to specify network configuration on kernel command line
via either ip= or network-config=<base64>.
Diffstat (limited to 'cloudinit/distros/__init__.py')
| -rw-r--r-- | cloudinit/distros/__init__.py | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/cloudinit/distros/__init__.py b/cloudinit/distros/__init__.py index e8220985..418421b9 100644 --- a/cloudinit/distros/__init__.py +++ b/cloudinit/distros/__init__.py @@ -75,6 +75,9 @@ class Distro(object): # to write this blob out in a distro format raise NotImplementedError() + def _write_network_config(self, settings): + raise NotImplementedError() + def _find_tz_file(self, tz): tz_file = os.path.join(self.tz_zone_dir, str(tz)) if not os.path.isfile(tz_file): @@ -132,6 +135,14 @@ class Distro(object): return self._bring_up_interfaces(dev_names) return False + def apply_network_config(self, netconfig, bring_up=False): + # Write it out + dev_names = self._write_network_config(netconfig) + # Now try to bring them up + if bring_up: + return self._bring_up_interfaces(dev_names) + return False + @abc.abstractmethod def apply_locale(self, locale, out_fn=None): raise NotImplementedError() |
