dir = sfatables_config + chain;
last_rule_number = 1
- for file in os.walk(dir):
- if (file.startswith('sfatables-')):
- number_str = file.split('-')[1]
- number = int(number_str)
- if (number>last_rule_number):
- last_rule_number = number
-
- return "sfatables-%d-%s"%(last_rule_number,type)
-
+ for (root, dirs, files) in os.walk(dir):
+ for file in files:
+ if (file.startswith('sfatables-')):
+ number_str = file.split('-')[1]
+ number = int(number_str)
+ if (number>last_rule_number):
+ last_rule_number = number
+ return "sfatables-%d-%s"%(last_rule_number+1,type)
def call(self, command_options, match_options, target_options):
- import pdb
filename = match_dir + "/"+match_options.match_name+".xml"
xmldoc = libxml2.parseFile(filename)
valueNode.addContent(option_value)
context[0].addChild(valueNode)
- pdb.set_trace()
chain = command_options.args[0]
filename = self.getnextfilename('match',chain)
- xmldoc.saveFile(filename)
+ file_path = sfatables_config + '/' + chain + '/' + filename
+ xmldoc.saveFile(file_path)
p.xpathFreeContext()
xmldoc.freeDoc()
-
return True
-