#NEWLINE# def add_rule( self , chain , rule , wrap = True , top = False ) : #NEWLINE# #INDENT# "Add a rule to the table.\n\n        This is just like what you'd feed to iptables, just without\n        the '-A <chain name>' bit at the start.\n\n        However, if you need to jump to one of your wrapped chains,\n        prepend its name with a '$' which will ensure the wrapping\n        is applied correctly.\n\n        " #NEWLINE# if ( wrap and ( chain not in self . chains ) ) : #NEWLINE# #INDENT# raise ValueError ( ( _ ( 'Unknown chain: %r' ) % chain ) ) #NEWLINE# #UNINDENT# if ( '$' in rule ) : #NEWLINE# #INDENT# rule = ' ' . join ( map ( self . _wrap_target_chain , rule . split ( ' ' ) ) ) #NEWLINE# #UNINDENT# rule_obj = IptablesRule ( chain , rule , wrap , top ) #NEWLINE# if ( rule_obj in self . rules ) : #NEWLINE# #INDENT# LOG . debug ( 'Skipping duplicate iptables rule addition. %(rule)r already in %(rules)r' , { #NEWLINE# #INDENT# 'rule' : rule_obj , #NEWLINE# 'rules' : self . rules , #NEWLINE# #UNINDENT# } ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# self . rules . append ( IptablesRule ( chain , rule , self , top ) ) #NEWLINE# self . dirty = True