HEX
Server: LiteSpeed
System: Linux s1049.use1.mysecurecloudhost.com 4.18.0-477.27.2.lve.el8.x86_64 #1 SMP Wed Oct 11 12:32:56 UTC 2023 x86_64
User: xedaptot (3356)
PHP: 8.3.31
Disabled: NONE
Upload Files
File: //lib/python3.6/site-packages/ipaclient/plugins/__pycache__/automount.cpython-36.opt-1.pyc
3

�d[e)*�@sddlZddlZddlmZddlmZmZddlmZmZddl	m
Z
mZmZddl
mZddlmZddlmZdd	lmZejr�eZe�ZdZdZedd
�Gdd�de��Zedd
�Gdd�de��Zeddd�Gdd�de��Ze�Gdd�de
��ZdS)�N)�MethodOverride)�api�errors)�Flag�Str)�Command�Method�Object)�Registry)�
classproperty)�_)�DN�auto.direct�/-T)�no_failc@seZdZdZdS)�_fake_automountlocationZautomountlocationN)�__name__�
__module__�__qualname__�name�rr�/usr/lib/python3.6/automount.pyr+src@seZdZdZdZdS)�_fake_automountlocation_show�automountlocation_showTN)rrrr�NO_CLIrrrrr0sr)�overriderc@s4eZdZedd��Zee�Zedd��Zdd�Z	dS)�automountlocation_tofilescCstjjd�tkS)Nr)rrZ
get_pluginr)�clsrrrZ__NO_CLI_getter8s
z)automountlocation_tofiles.__NO_CLI_gettercCs|jjjjS)N)rrr�api_version)�selfrrrr?sz%automountlocation_tofiles.api_versionc
Os�|dd}|dd}|dd}|dd}|jd�xd|D]\}|ddjd	�rz|jd
|dd|ddf�q@|jd|dd|ddf�q@Wxx|D]p}|ddjd	�r�q�|dd}	|jd
�|jd|	�x2||	D]&}
|jd
|
dd|
ddf�q�Wq�W|jd�|jtd��x�|D]�}|jd
�|jd|d�xt|D]l}
t|
�dk�rt�q^xR|
D]J}t|d�}|d|ddk�rz|jd
|dd|ddf��qzW�q^W�q8WdS)N�result�maps�keys�
orphanmaps�
orphankeysz/etc/auto.master:�automountinformationr�-z%s	%s�automountkeyz
%s	/etc/%sz---------------------------z/etc/%s:�z'maps not connected to /etc/auto.master:Zautomountmapname�dn)�print_plain�
startswithr�lenr
)
r�textuir r"�optionsr!r#r$�m�info�k�keyr)rrr�output_for_cliCsL

 

$





z(automountlocation_tofiles.output_for_cliN)
rrr�classmethodZ)_automountlocation_tofiles__NO_CLI_getterrr�propertyrr3rrrrr6srcsheZdZed�Zeded�ed�d�fZedded�d	�fZ�fd
d�Z	dd
�Z
dd�Zdd�Z�Z
S)�automountlocation_importz/Import automount files for a specific location.Z
masterfilezMaster filezAutomount master file.)Zlabel�docz	continue?�continuezIContinuous operation mode. Errors are reported but the process continues.)Zcli_namer7c#s@x|jjjj�D]
}|VqWxtt|�j�D]
}|Vq.WdS)N)rrr�args�superr6�get_args)r�arg)�	__class__rrr;�s
z!automountlocation_import.get_argscCslyt|d�}|j�}|j�WnHtk
rf}z,|jdkrTtjtd�d|id��n�WYdd}~XnX|S)N�r�zFile %(file)s not found�file)�reason)�open�	readlines�close�IOError�errnorZNotFoundr)r�filename�fp�map�errrZ__read_mapfile�s

z'automountlocation_import.__read_mapfilecOs�|jjd|d�gggggd�}i}|j|d�}�x|D�]}|jd�rPq>|j�}|jd�rz|dj||dg�q>t|�dkr�q>|jd�}t|�d	kr�q>|djd
�r�|djdd�}t	j
j|d�|d<|||d<yNtjd
|ddt|d�tdj
|dd���d�|dj|ddg�Wnltjk
�r�t|d�tk�rTn@|jdd��rv|dj|d�ntjtd�t|dd�d��YnX|djd�s>y2tjd|dt|d��|dj|d�Wq>tjk
�rFt|d�tk�rn@|jdd��r$|dj|d�ntjtd�t|dd�d��Yq>Xq>W�x||j�D�]n\}}	|j|	�}
g}d}x�|
D]�}
|
jd��r��qz|
j�}
|
jd��r�|dj||	g��qzt|
�dk�rʐqz|
jd��r�||
dd �d}n|j||
�d}�qzWx�|D]�}
|
jd�}t|djdd��}yFtjd
|dt|�|tdj
|dd���d�|dj||g�WnLtjk
�r�}z,|jdd��r�|dj|d�n|�WYdd}~XnX�q
W�qXWt|d�S)!z�
        The basic idea is to read the master file and create all the maps
        we need, then read each map file and add all the keys for the map.
        rr)r!r"�skipped�
duplicatekeys�
duplicatemaps��#�+rKNr?�/�"r(Zautomountkey_addzauto.master� )r'r%r"r8FrLzkey %(key)s already exists)r2)�messager&Zautomountmap_addr!rMzmap %(map)s already exists)rI�\)r ���)rr�'_automountlocation_import__read_mapfiler+�rstrip�appendr,�split�replace�os�path�basename�unicode�joinrZDuplicateEntry�DEFAULT_KEYS�getr�dict�DEFAULT_MAPS�items�endswith)rr9r.r r!Zmasterr/ZamZmapfilerGrI�linesZcont�xr2rJrrr�forward�s�








"z automountlocation_import.forwardcOs�|dd}|dd}|dd}|dd}|dd}|jtd��x$|D]}	|jtd�t|	d	��qPW|jd
�|jtd��x.|D]&}
|jtd�t|
d
|
dd��q�W|jd
�t|�d
k�r|jtd��x.|D]&}
|jtd�t|
d
|
dd��q�W|jdd��rjt|�d
k�rj|jd
�|jtd��x&|D]}	|jtd�t|	d	���qHW|jdd��r�t|�d
k�r�|jd
�|jtd��x&|D]}
|jtd�t|
d���q�WdS)Nr r!r"rMrLrKzImported maps:z
Added %(map)s)rIr(zImported keys:zAdded %(src)s to %(dst)srrN)�src�dstz
Ignored keys:zIgnored %(src)s to %(dst)sr8FzDuplicate maps skipped:zSkipped %(map)szDuplicate keys skipped:zSkipped %(key)s)r2)r*rrcr,rb)rr-r r"r.r!rMrLrKr/r1rrrr3sD








z'automountlocation_import.output_for_cli)rrrr�__doc__rZ
takes_argsrZ
takes_optionsr;rWrir3�
__classcell__rr)r=rr6vser6)r)r)r\ZsixZipaclient.frontendrZipalibrrrrZipalib.frontendrrr	Zipalib.plugabler
Zipalib.utilrrZipapython.dnr
ZPY3�strr_�registerrdrarrrr6rrrr�<module>s,?