X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=sfatables%2Fcommands%2FAdd.py;h=987cff50e719b45b3d6ac51fdd8cd97cdd3595bd;hb=57b6a99255d4a88be9c0f910f8524677e34ff4bc;hp=da02e869258646c75e1cdd2fac8ca19a15dffe47;hpb=b940fd55d99f2929cd0d6b47dd6d75db714c90cd;p=sfa.git diff --git a/sfatables/commands/Add.py b/sfatables/commands/Add.py index da02e869..987cff50 100644 --- a/sfatables/commands/Add.py +++ b/sfatables/commands/Add.py @@ -1,15 +1,14 @@ -import os, time +import os import libxml2 from sfatables.command import Command -from sfatables.globals import * +from sfatables.globals import sfatables_config, target_dir, match_dir class Add(Command): - options = [('-A','--add')] - help = 'Add a rule to a chain' - matches = True - targets = True - def __init__(self): + self.options = [('-A','--add')] + self.help = 'Add a rule to a chain' + self.matches = True + self.targets = True return def getnextfilename(self,type,chain): @@ -42,7 +41,7 @@ class Add(Command): option_name = option['name'] option_value = getattr(options,option_name) - if (hasattr(options,option_name)): + if (hasattr(options,option_name) and getattr(options,option_name)): context = p.xpathEval("//rule[@element='%s' or @element='*']/argument[name='%s']"%(element, option_name)) if (not context): raise Exception('Unknown option %s for match %s and element %s'%(option,option['name'], element))