Mini Shell
�
�o�i�% � � � d dl mZ d dl mZ d dl mZ d dl mZ d dlmZ ej � � d dlT d dl Z d dl
Z
d dlZd dlZd dl
Z
d dlZd dlZd dlmZmZmZmZmZmZ d d lmZ d d
lmZ d dlmZ d� Zd
� Zd� Z dd�Z!dS )� )�absolute_import)�division)�print_function)�unicode_literals)�standard_library)�*N)�get_list_of_users�cagefs_is_enabled�save_dir_exists�get_exclude_user_list�get_min_uid�MIN_UID)� read_file)�ispmanager_create_user_wrapper)�mod_makedirsc �� � t j � � t j � � sdS t j � d� � �rddg} t j | dd�� � � d� � }|D ]�}|� d� � d k r�t |� d
� � d �
dd� � � � � � � }| � d
|z ddddg� � t j | dd�� � ��dS # t $ r-}t j dt |� � � � Y d}~dS d}~ww xY wt j � � �rx d}t# � � }g d�} t j | dd�� � � d� � }|D ]|}|� d� � re|� � � � d� � }t% |� � dk r�R|d � d� � }|D ]
}d|v rd} n� n�}|sud� |� � dz dz } | � � � } | � d| z dg� � t j | dd�� � � d� � dS dS # t t( f$ r-}t j dt |� � � � Y d}~dS d}~ww xY wdS )zF
Install exclude .cagefs folder from backup
:return: None
N�4z/usr/local/ispmgr/sbin/mgrctl�
backupplanF)�check_return_code�
exit_on_error�
zid=���zname=r � z.content.edit plid=zsok=okztype=excludezmodule=filezfiledata=.cagefsz+Failed to set exclude dir for ISPManager 4:)z/usr/local/mgr5/sbin/mgrctlz-m�ispmgrzbackup2.settings�
exclude_files�=� � � z.cagefsTzdata/.cagefszexclude_files=%sz+Failed to set exclude dir for ISPManager 5:)�detect�getCP�
is_ispmanager�
CP_VERSION�
startswith� cagefslib�Execute�split�find�str�replace�strip�extend�OSError�secureio�print_error�ispmanager5_is_master�list�len�join�IOError)
�isp_command_list�result�line�plan_id�e�cagefs_exclude_is_found�exclude_files_list�l_parts�exclude_file�add_lines
�i/builddir/build/BUILDROOT/cagefs-7.6.32-1.el8.cloudlinux.x86_64/usr/share/cagefs/cagefs_ispmanager_lib.py�$install_ispmanager_directory_excluder@ >