X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=sfatables%2Fcommands%2FAdd.py;h=da02e869258646c75e1cdd2fac8ca19a15dffe47;hb=b940fd55d99f2929cd0d6b47dd6d75db714c90cd;hp=f5193eb6d8a7fe5ca558c2521b710baa7358a9f3;hpb=6c41d17ff2f98c362ad1db112d22bede960d8202;p=sfa.git diff --git a/sfatables/commands/Add.py b/sfatables/commands/Add.py index f5193eb6..da02e869 100644 --- 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): - filename = dir + "/"+options.name+".xml" + filename = os.path.join(dir, options.name+".xml") xmldoc = libxml2.parseFile(filename) p = xmldoc.xpathNewContext() @@ -53,7 +53,9 @@ class Add(Command): 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()