summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJavier Jardón <javier.jardon@codethink.co.uk>2015-02-27 12:41:32 +0000
committerJavier Jardón <javier.jardon@codethink.co.uk>2015-02-27 12:44:14 +0000
commit1b8566f258f349794e7c9ccc48c1226cec23c3be (patch)
treee0f5aaf23395d203407798491760f1942c7e038c
parent83a53022d8d8cbe175d48e99495240f6c17f09e9 (diff)
downloadmorph-1b8566f258f349794e7c9ccc48c1226cec23c3be.tar.gz
simple-network.configure: Generate .network format
-rwxr-xr-xmorphlib/exts/simple-network.configure13
1 files changed, 9 insertions, 4 deletions
diff --git a/morphlib/exts/simple-network.configure b/morphlib/exts/simple-network.configure
index 68de7723..683e9581 100755
--- a/morphlib/exts/simple-network.configure
+++ b/morphlib/exts/simple-network.configure
@@ -86,11 +86,16 @@ class SimpleNetworkConfigurationExtension(cliapp.Application):
name = stanza['name']
itype = stanza['type']
- lines = ["auto %s" % name, "iface %s inet %s" % (name, itype)]
- lines += [" %s %s" % elem for elem in stanza['args'].items()]
- lines += [""]
- return "\n".join(lines)
+ lines = ["[Match]"]
+ lines += ["Name=%s\n" % name]
+ lines += ["[Network]"]
+ if itype == "dhcp":
+ lines += ["DHCP=yes"]
+ else:
+ lines += ["%s=%s" % elem for elem in stanza['args'].items()]
+
+ return "\n".join(lines)
def parse_network_stanzas(self, config):
"""Parse a network config environment variable into stanzas.