diff options
author | Javier Jardón <javier.jardon@codethink.co.uk> | 2015-02-27 12:41:36 +0000 |
---|---|---|
committer | Javier Jardón <javier.jardon@codethink.co.uk> | 2015-02-27 12:44:14 +0000 |
commit | d9f1ebed08da73bd65924e514830db9481c8b8b1 (patch) | |
tree | 0c9f64c448f006021a4b81ce36c6601f4458ec2c | |
parent | 1b8566f258f349794e7c9ccc48c1226cec23c3be (diff) | |
download | morph-d9f1ebed08da73bd65924e514830db9481c8b8b1.tar.gz |
simple-network.configure: No need to order interfaces in the configuration file
We generate a new .network file for each interface
-rwxr-xr-x | morphlib/exts/simple-network.configure | 21 |
1 files changed, 1 insertions, 20 deletions
diff --git a/morphlib/exts/simple-network.configure b/morphlib/exts/simple-network.configure index 683e9581..2c098416 100755 --- a/morphlib/exts/simple-network.configure +++ b/morphlib/exts/simple-network.configure @@ -62,26 +62,7 @@ class SimpleNetworkConfigurationExtension(cliapp.Application): with open(path, "w") as f: f.write(iface_file) - def generate_iface_file(self, stanzas): - """Generate an interfaces file from the provided stanzas. - - The interfaces will be sorted by name, with loopback sorted first. - """ - - def cmp_iface_names(a, b): - a = a['name'] - b = b['name'] - if a == "lo": - return -1 - elif b == "lo": - return 1 - else: - return cmp(a,b) - - return "\n".join(self.generate_iface_stanza(stanza) - for stanza in sorted(stanzas, cmp=cmp_iface_names)) - - def generate_iface_stanza(self, stanza): + def generate_iface_file(self, stanza): """Generate an interfaces stanza from the provided data.""" name = stanza['name'] |