summaryrefslogtreecommitdiff
path: root/cloudinit
diff options
context:
space:
mode:
authorWesley Wiedenmeier <wesley.wiedenmeier@gmail.com>2016-03-22 02:02:22 -0500
committerWesley Wiedenmeier <wesley.wiedenmeier@gmail.com>2016-03-22 02:02:22 -0500
commit7eccb0f0f3693662b3f288e7a74cb5bd6d7814ea (patch)
tree86c80f098f5b73c93f00103e4877af64e2be1add /cloudinit
parente66bcc8b2ea7648c15476cdd43d3753ee6c27ff1 (diff)
downloadvyos-cloud-init-7eccb0f0f3693662b3f288e7a74cb5bd6d7814ea.tar.gz
vyos-cloud-init-7eccb0f0f3693662b3f288e7a74cb5bd6d7814ea.zip
In generate_fallback_config return full netconfig dict with 'config' and
'version' keys
Diffstat (limited to 'cloudinit')
-rw-r--r--cloudinit/distros/debian.py5
-rw-r--r--cloudinit/net/__init__.py11
2 files changed, 10 insertions, 6 deletions
diff --git a/cloudinit/distros/debian.py b/cloudinit/distros/debian.py
index 0fa47274..de8c4c6c 100644
--- a/cloudinit/distros/debian.py
+++ b/cloudinit/distros/debian.py
@@ -85,8 +85,9 @@ class Distro(distros.Distro):
def _write_network_fallback(self):
# old fallback configuration is obsolete, disable it
util.disable_conf_file('/etc/network/interfaces.d/eth0.cfg')
- ns = net.generate_fallback_config()
- if ns is not None:
+ nconf = net.generate_fallback_config()
+ if nconf is not None:
+ ns = nconf['config']
net.render_network_state(network_state=ns, target="/")
return []
diff --git a/cloudinit/net/__init__.py b/cloudinit/net/__init__.py
index 48b82a2c..389c2afb 100644
--- a/cloudinit/net/__init__.py
+++ b/cloudinit/net/__init__.py
@@ -287,8 +287,11 @@ def generate_fallback_config():
"""Determine which attached net dev is most likely to have a connection and
generate network state to run dhcp on that interface"""
# by default use eth0 as primary interface
- ns = {'interfaces': {}, 'dns': {'search': [], 'nameservers': []},
- 'routes': []}
+ nconf = {'config': {'interfaces': {},
+ 'dns': {'search': [], 'nameservers': []}, 'routes': []
+ },
+ 'version': 1
+ }
# get list of interfaces that could have connections
invalid_interfaces = set(['lo'])
@@ -351,13 +354,13 @@ def generate_fallback_config():
target_name = name
# generate net config for interface
- ns['interfaces'][target_name] = {
+ nconf['config']['interfaces'][target_name] = {
'mac_address': mac, 'name': target_name, 'type': 'physical',
'mode': 'manual', 'inet': 'inet',
'subnets': [{'type': 'dhcp4'}, {'type': 'dhcp6'}]
}
- return ns
+ return nconf
def render_persistent_net(network_state):