HEX
Server: Apache
System: Linux zacp120.webway.host 4.18.0-553.50.1.lve.el8.x86_64 #1 SMP Thu Apr 17 19:10:24 UTC 2025 x86_64
User: govancoz (1003)
PHP: 8.3.26
Disabled: exec,system,passthru,shell_exec,proc_close,proc_open,dl,popen,show_source,posix_kill,posix_mkfifo,posix_getpwuid,posix_setpgid,posix_setsid,posix_setuid,posix_setgid,posix_seteuid,posix_setegid,posix_uname
Upload Files
File: //lib/python3.6/site-packages/fail2ban/server/__pycache__/jails.cpython-36.pyc
3

UB(d�@szdZdZdZddlmZyddlmZWn ek
rHddlmZYnXddl	m
Z
mZdd	lm
Z
Gd
d�de�ZdS)
z!Cyril Jaquier, Yaroslav Halchenkoz:Copyright (c) 2004 Cyril Jaquier, 2013- Yaroslav HalchenkoZGPL�)�Lock)�Mapping�)�DuplicateJailException�UnknownJailException�)�Jailc@sJeZdZdZdd�Zddd�Zdd�Zd	d
�Zdd�Zd
d�Z	dd�Z
dS)�JailsaBHandles the jails.

	This class handles the jails. Creation, deletion or access to a jail
	must be done through this class. This class is thread-safe which is
	not the case of the jail itself, including filter and actions. This
	class is based on Mapping type, and the `add` method must be used to
	add additional jails.
	cCst�|_t�|_dS)N)r�_Jails__lock�dict�_jails)�self�r�/usr/lib/python3.6/jails.py�__init__,szJails.__init__NcCs@|j�0||jkr tr2t|��nt|||�|j|<WdQRXdS)aUAdds a jail.

		Adds a new jail if not already present which should use the
		given backend.

		Parameters
		----------
		name : str
			The name of the jail.
		backend : str
			The backend to use.
		db : Fail2BanDb
			Fail2Ban's persistent database instance.

		Raises
		------
		DuplicateJailException
			If jail name is already present.
		N)r
rZnoduplicatesrr)r
�nameZbackendZdbrrr�add0s


z	Jails.addcCs
||jkS)N)r)r
rrrr�existsKszJails.existscCsHz6y|jj�|j|Stk
r2t|��YnXWd|jj�XdS)N)r
�acquirer�KeyErrorr�release)r
rrrr�__getitem__Ns

zJails.__getitem__cCsJz8y|jj�|j|=Wntk
r4t|��YnXWd|jj�XdS)N)r
rrrrr)r
rrrr�__delitem__Ws
zJails.__delitem__c
Cs&z|jj�t|j�S|jj�XdS)N)r
r�lenrr)r
rrr�__len__`s

z
Jails.__len__c
Cs&z|jj�t|j�S|jj�XdS)N)r
r�iterrr)r
rrr�__iter__gs

zJails.__iter__)N)�__name__�
__module__�__qualname__�__doc__rrrrrrrrrrrr	"s
		r	N)�
__author__Z
__copyright__Z__license__Z	threadingr�collections.abcr�ImportError�collections�
exceptionsrrZjailrr	rrrr�<module>s