git://git.onelab.eu
/
sfa.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
- fix writing sfatables rules
[sfa.git]
/
sfatables
/
commands
/
Add.py
diff --git
a/sfatables/commands/Add.py
b/sfatables/commands/Add.py
index
f5193eb
..
da02e86
100644
(file)
--- a/
sfatables/commands/Add.py
+++ b/
sfatables/commands/Add.py
@@
-27,7
+27,7
@@
class Add(Command):
return "sfatables-%d-%s"%(last_rule_number+1,type)
def call_gen(self, chain, type, dir, options):
return "sfatables-%d-%s"%(last_rule_number+1,type)
def call_gen(self, chain, type, dir, options):
- filename =
dir + "/"+options.name+".xml"
+ filename =
os.path.join(dir, options.name+".xml")
xmldoc = libxml2.parseFile(filename)
p = xmldoc.xpathNewContext()
xmldoc = libxml2.parseFile(filename)
p = xmldoc.xpathNewContext()
@@
-53,7
+53,9
@@
class Add(Command):
context[0].addChild(valueNode)
filename = self.getnextfilename(type,chain)
context[0].addChild(valueNode)
filename = self.getnextfilename(type,chain)
- file_path = sfatables_config + '/' + chain + '/' + filename
+ file_path = os.path.join(sfatables_config, chain, filename)
+ if not os.path.isdir(os.path.dirname(file_path)):
+ os.makedirs(os.path.dirname(file_path))
xmldoc.saveFile(file_path)
p.xpathFreeContext()
xmldoc.freeDoc()
xmldoc.saveFile(file_path)
p.xpathFreeContext()
xmldoc.freeDoc()