2 from sfatables.globals import *
3 from sfatables.command import Command
6 options = [('-D','--delete')]
7 help = 'Delete a rule from a chain'
15 def call(self, command_options, match_options, target_options):
17 if (len(command_options.args)<2):
18 print "Please specify the chain and the rule number to delete, e.g. sfatables -D INCOMING 1."
21 chain = command_options.args[0]
24 rule_number = command_options.args[1]
25 chain_dir = sfatables_config + "/" + chain
27 match_path = chain_dir + "/" + "sfatables-%s-match"%rule_number
28 target_path = chain_dir + "/" + "sfatables-%s-target"%rule_number
31 os.unlink(target_path)