summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJavier Jardón <javier.jardon@codethink.co.uk>2015-02-27 12:41:26 +0000
committerJavier Jardón <javier.jardon@codethink.co.uk>2015-02-27 12:44:13 +0000
commit83a53022d8d8cbe175d48e99495240f6c17f09e9 (patch)
tree7cbda2fd306ba69c430b70e0f8cd2f9953868d10
parentbc3e042560424b433a408f01725f36cc2d47859c (diff)
downloadmorph-83a53022d8d8cbe175d48e99495240f6c17f09e9.tar.gz
simple-network.configure: write to .network files
... instead /etc/network/interfaces
-rwxr-xr-xmorphlib/exts/simple-network.configure14
1 files changed, 11 insertions, 3 deletions
diff --git a/morphlib/exts/simple-network.configure b/morphlib/exts/simple-network.configure
index b98b202c..68de7723 100755
--- a/morphlib/exts/simple-network.configure
+++ b/morphlib/exts/simple-network.configure
@@ -49,10 +49,18 @@ class SimpleNetworkConfigurationExtension(cliapp.Application):
self.status(msg="Processing NETWORK_CONFIG=%(nc)s", nc=network_config)
stanzas = self.parse_network_stanzas(network_config)
- iface_file = self.generate_iface_file(stanzas)
+ for stanza in stanzas:
- with open(os.path.join(args[0], "etc/network/interfaces"), "w") as f:
- f.write(iface_file)
+ iface_file = self.generate_iface_file(stanza)
+
+ if iface_file is None:
+ continue
+
+ path = os.path.join(args[0], "etc", "systemd", "network",
+ "%s.network" % stanza['name'])
+
+ with open(path, "w") as f:
+ f.write(iface_file)
def generate_iface_file(self, stanzas):
"""Generate an interfaces file from the provided stanzas.