From 1c125ade7e19d1f92b49ad010ff4a9ec3faa36e4 Mon Sep 17 00:00:00 2001 From: Richard Ipsum Date: Wed, 15 Apr 2015 15:58:34 +0100 Subject: Add dns option to simple-network conf ext Change-Id: I0f4490d76caca802536b21085ea0d770fb8c0798 --- morphlib/exts/simple-network.configure | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) 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): -- cgit v1.2.1