summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRichard Ipsum <richard.ipsum@codethink.co.uk>2015-04-15 15:58:34 +0100
committerRichard Ipsum <richard.ipsum@codethink.co.uk>2015-04-15 16:04:38 +0100
commit1c125ade7e19d1f92b49ad010ff4a9ec3faa36e4 (patch)
tree93b9ab080cb93b4113ce332ffc57d77981a80365
parentfd4d6afc778f633b0e4d3df3c478599d7cc1f7fe (diff)
downloadmorph-1c125ade7e19d1f92b49ad010ff4a9ec3faa36e4.tar.gz
Add dns option to simple-network conf ext
Change-Id: I0f4490d76caca802536b21085ea0d770fb8c0798
-rwxr-xr-xmorphlib/exts/simple-network.configure9
1 files changed, 8 insertions, 1 deletions
diff --git a/morphlib/exts/simple-network.configure b/morphlib/exts/simple-network.configure
index 1ba94e86..4a70f311 100755
--- a/morphlib/exts/simple-network.configure
+++ b/morphlib/exts/simple-network.configure
@@ -188,7 +188,9 @@ class SimpleNetworkConfigurationExtension(cliapp.Application):
address = None
netmask = None
gateway = None
+ dns = None
lines = []
+
for pair in pairs:
if pair[0] == 'address':
address = pair[1]
@@ -196,6 +198,8 @@ class SimpleNetworkConfigurationExtension(cliapp.Application):
netmask = pair[1]
elif pair[0] == 'gateway':
gateway = pair[1]
+ elif pair[0] == 'dns':
+ dns = pair[1]
if address and netmask:
network_suffix = self.convert_net_mask_to_cidr_suffix (netmask);
@@ -204,9 +208,12 @@ class SimpleNetworkConfigurationExtension(cliapp.Application):
elif address or netmask:
raise Exception('address and netmask must be specified together')
- if gateway is not None:
+ if gateway:
lines += ["Gateway=%s" % gateway]
+ if dns:
+ lines += ["DNS=%s" % dns]
+
return lines
def convert_net_mask_to_cidr_suffix(self, mask):