관리-도구
편집 파일: fw_transaction.cpython-36.pyc
3 @)�f� � @ sJ d Z dgZddlZddlmZ ddlmZ ddlmZ G dd� de �Z dS )z!Transaction classes for firewalld�FirewallTransaction� N)�log)�errors)� FirewallErrorc @ s� e Zd Zdd� Zdd� Zdd� Zdd� Zd d � Zdd� Zd d� Z dd� Z dd� Zdd� Zdd� Z dd� Zdd� Zdd� Zdd� Zdd � Zd!d"� Zd#S )$r c C s( || _ i | _g | _g | _g | _g | _d S )N)�fw�rules� pre_funcs� post_funcs� fail_funcs�modules)�selfr � r �$/usr/lib/python3.6/fw_transaction.py�__init__! s zFirewallTransaction.__init__c C s2 | j j� | jd d �= | jd d �= | jd d �= d S )N)r �clearr r r )r r r r r ) s zFirewallTransaction.clearc C s | j j|jg �j|� d S )N)r � setdefault�name�append)r �backend�ruler r r �add_rule/ s zFirewallTransaction.add_rulec C s x|D ]}| j ||� qW d S )N)r )r r r r r r r � add_rules2 s zFirewallTransaction.add_rulesc C s |j | jko|| j|j kS )N)r r )r r r r r r � query_rule6 s zFirewallTransaction.query_rulec C s2 |j | jkr.|| j|j kr.| j|j j|� d S )N)r r �remove)r r r r r r �remove_rule9 s zFirewallTransaction.remove_rulec G s | j j||f� d S )N)r r )r �func�argsr r r �add_pre= s zFirewallTransaction.add_prec G s | j j||f� d S )N)r r )r r r r r r �add_post@ s zFirewallTransaction.add_postc G s | j j||f� d S )N)r r )r r r r r r �add_failC s zFirewallTransaction.add_failc C s || j kr| j j|� d S )N)r r )r �moduler r r � add_moduleF s zFirewallTransaction.add_modulec C s || j kr| j j|� d S )N)r r )r r r r r � remove_moduleJ s z!FirewallTransaction.remove_modulec C s x|D ]}| j |� qW d S )N)r! )r r r r r r �add_modulesN s zFirewallTransaction.add_modulesc C s x|D ]}| j |� qW d S )N)r"