diff options
-rwxr-xr-x | morphlib/exts/simple-network.configure | 14 |
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. |