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
commitdba74b1f8ac331571d32e094c3afbc33b2b02b2b (patch)
tree3fc139f4a9829ff31662ee17acaddea8ce3ed6e5
parent7e9cbf49d4de378823b9abede465a53185274fc5 (diff)
downloaddefinitions-dba74b1f8ac331571d32e094c3afbc33b2b02b2b.tar.gz
Add dns option to simple-network conf ext
Change-Id: I0f4490d76caca802536b21085ea0d770fb8c0798
-rwxr-xr-xsimple-network.configure9
1 files changed, 8 insertions, 1 deletions
diff --git a/simple-network.configure b/simple-network.configure
index 1ba94e86..4a70f311 100755
--- a/simple-network.configure
+++ b/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):