Exemplo n.º 1
0
 def wrapper(*args, **kwargs):
     try:
         base = ipwrapper.ruleList()
         func(*args, **kwargs)
     except Exception:
         restoreRules(base)
         raise
Exemplo n.º 2
0
Arquivo: utils.py Projeto: EdDev/vdsm
 def wrapper(*args, **kwargs):
     try:
         base = ipwrapper.ruleList()
         func(*args, **kwargs)
     except Exception:
         restoreRules(base)
         raise
Exemplo n.º 3
0
 def rules():
     rules_data = ruleList()
     for rule_data in rules_data:
         try:
             r = Rule.fromText(rule_data)
             yield IPRuleData(r.destination, r.source, r.srcDevice, r.table)
         except ValueError:
             logging.warning('Could not parse rule %s', rule_data)
Exemplo n.º 4
0
 def rules():
     rules_data = ruleList()
     for rule_data in rules_data:
         try:
             r = Rule.fromText(rule_data)
             yield IPRuleData(r.destination, r.source, r.srcDevice, r.table)
         except ValueError:
             logging.warning('Could not parse rule %s', rule_data)
Exemplo n.º 5
0
def restoreRules(base):
    current = ipwrapper.ruleList()
    added = set(current) - set(base)
    for rule in added:
        ipwrapper.ruleDel(ipwrapper.Rule.fromText(rule))
Exemplo n.º 6
0
Arquivo: utils.py Projeto: EdDev/vdsm
def restoreRules(base):
    current = ipwrapper.ruleList()
    added = set(current) - set(base)
    for rule in added:
        ipwrapper.ruleDel(ipwrapper.Rule.fromText(rule))