diff options
author | Javier Jardón <javier.jardon@codethink.co.uk> | 2015-02-27 12:41:32 +0000 |
---|---|---|
committer | Javier Jardón <javier.jardon@codethink.co.uk> | 2015-02-27 12:44:14 +0000 |
commit | 1b8566f258f349794e7c9ccc48c1226cec23c3be (patch) | |
tree | e0f5aaf23395d203407798491760f1942c7e038c | |
parent | 83a53022d8d8cbe175d48e99495240f6c17f09e9 (diff) | |
download | morph-1b8566f258f349794e7c9ccc48c1226cec23c3be.tar.gz |
simple-network.configure: Generate .network format
-rwxr-xr-x | morphlib/exts/simple-network.configure | 13 |
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. |