HEX
Server: LiteSpeed
System: Linux us-phx-web629.main-hosting.eu 5.14.0-503.23.2.el9_5.x86_64 #1 SMP PREEMPT_DYNAMIC Wed Feb 12 05:52:18 EST 2025 x86_64
User: u756937133 (756937133)
PHP: 8.2.30
Disabled: passthru,chgrp
Upload Files
File: //usr/lib/frr/__pycache__/generate_support_bundle.cpython-39.pyc
a

>�sgN�@sJddlZddlZddlZddlZddlZdd�Zdd�ZedkrFe�dS)�NcCs6tj�|�r,td|�tjd�|�dd�t|d�S)NzMaking backup of zmv {0} {0}.prevT)�shell�w)�os�path�exists�print�
subprocessZ
check_call�format�open)r�r�'/usr/lib/frr/generate_support_bundle.py�open_with_backupsr
c
Cs�t��}|jddddd�|jdddd	d�|��}d
}i}d}d}z�t|j�D]�}|��}t|�dksP|ddkrvqP|�d
�}|ddkr�|d}t	�
d�}d
}qP|ddkr�d}qP|ddkr�d
}|��t|j�||<|�
�qP|r�|�|d�qPtd|���qPWn<t�yJ}z"t�d|jt|��WYd}~dSd}~00g}	|D]D}tj�|j|d�}
tjgd�||t|
�tjd�}|	�|��qT|	D]}|���q�dS)Nz-cz--configz%/etc/frr/support_bundle_commands.confzinput config)�default�helpz-lz	--log-dirz/var/log/frrzdirectory for logfilesFr�#�:Z	PROC_NAME�zw+ZCMD_LIST_STARTTZCMD_LIST_END�
zIgnoring unexpected input zCannot read config file: %s: %sz_support_bundle.log)z/usr/bin/envZvtyshz-t)�stdin�stdout�stderr)�argparse�ArgumentParser�add_argument�
parse_argsr
Zconfig�rstrip�len�split�tempfileZNamedTemporaryFile�flush�name�close�writer�IOError�loggingZfatal�strrr�joinZlog_dirr�Popenr
ZSTDOUT�append�wait)�parser�argsZ
collectingZ	proc_cmds�procZtemp�lineZcmd_line�errorZprocsZofn�prrr�main%sd��


�r0�__main__)rr$rrrr
r0�__name__rrrr�<module>s=