This change allows to "restore" a file multiple times without problems.
If the set already exists, the create command will skip it and we will
flush any existing content to load the new one.
Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
suffix = "ipset"
def _write_header(self):
- self.f.write("create %s hash:net family inet hashsize 1024 maxelem 65536\n" % self.prefix)
+ self.f.write("create %s hash:net family inet hashsize 1024 maxelem 65536 -exist\n" % self.prefix)
+ self.f.write("flush %s\n" % self.prefix)
def write(self, network):
self.f.write("add %s %s\n" % (self.prefix, network))