summaryrefslogtreecommitdiff
path: root/cloudinit/net
diff options
context:
space:
mode:
Diffstat (limited to 'cloudinit/net')
-rw-r--r--cloudinit/net/network_state.py10
1 files changed, 10 insertions, 0 deletions
diff --git a/cloudinit/net/network_state.py b/cloudinit/net/network_state.py
index 1dd7ded7..6d63e5c5 100644
--- a/cloudinit/net/network_state.py
+++ b/cloudinit/net/network_state.py
@@ -708,6 +708,7 @@ class NetworkStateInterpreter(object):
gateway4 = None
gateway6 = None
+ nameservers = {}
for address in cfg.get('addresses', []):
subnet = {
'type': 'static',
@@ -723,6 +724,15 @@ class NetworkStateInterpreter(object):
gateway4 = cfg.get('gateway4')
subnet.update({'gateway': gateway4})
+ if 'nameservers' in cfg and not nameservers:
+ addresses = cfg.get('nameservers').get('addresses')
+ if addresses:
+ nameservers['dns_nameservers'] = addresses
+ search = cfg.get('nameservers').get('search')
+ if search:
+ nameservers['dns_search'] = search
+ subnet.update(nameservers)
+
subnets.append(subnet)
routes = []