예제 #1
0
 def wrapper(*args, **kwargs):
     try:
         base = ipwrapper.ruleList()
         func(*args, **kwargs)
     except Exception:
         restoreRules(base)
         raise
예제 #2
0
파일: utils.py 프로젝트: EdDev/vdsm
 def wrapper(*args, **kwargs):
     try:
         base = ipwrapper.ruleList()
         func(*args, **kwargs)
     except Exception:
         restoreRules(base)
         raise
예제 #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)
예제 #4
0
파일: iproute2.py 프로젝트: EdDev/vdsm
 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)
예제 #5
0
def restoreRules(base):
    current = ipwrapper.ruleList()
    added = set(current) - set(base)
    for rule in added:
        ipwrapper.ruleDel(ipwrapper.Rule.fromText(rule))
예제 #6
0
파일: utils.py 프로젝트: EdDev/vdsm
def restoreRules(base):
    current = ipwrapper.ruleList()
    added = set(current) - set(base)
    for rule in added:
        ipwrapper.ruleDel(ipwrapper.Rule.fromText(rule))