Current File : //proc/self/root/usr/lib/python3/dist-packages/sos/report/__pycache__/__init__.cpython-312.pyc
�

-�_g�:��d�ddlZddlZddlZddlZddlZddlZddlZddlmZddlZddl	m
Z
ddl	mZddl
mZddlZddlmZmZmZmZmZmZmZddlmZddlmZdd	lmZddlZdd
lm Z m!Z!m"Z"m#Z#m$Z$m%Z%m&Z&m'Z'm(Z(m)Z)ddl*m+Z+ejXejZfZ.dd�Z/d
�Z0gd�Z1Gd�de�Z2y)�N)�datetime)�ThreadPoolExecutor)�TimeoutError)�rmtree)�ImporterHelper�SoSTimeoutError�bold�sos_get_command_output�TIMEOUT_DEFAULT�listdir�
is_executable)�_sos)�__version__)�SoSComponent)
�Report�Section�Command�
CopiedFile�CreatedFile�Alert�Note�PlainTextReport�
JSONReport�
HTMLReport)�
SoSCleanerc�(�g}|}|rt|�dz}nd}|D]C}t|�t|�zt|�zdkDr|j|�|}||z|z}�E|t|�d|k(r|dt|�}|j|�|S)N� ��H)�len�append)�
first_line�items�indent�sep�lines�line�newline�items        �5/usr/lib/python3/dist-packages/sos/report/__init__.py�_format_listr+-s����E��D�
��j�/�C�'�����!���t�9�s�4�y� �3�s�8�+�b�0��L�L����D��d�{�S� ��	!�
�S��X�I�J��3���J�c�#�h�Y���	�L�L����L�c�2�tj|d�d�S)z� This function will format --since arg to append 0s if enduser
    didn't. It's used in the _get_parser.
    This will also be a good place to add human readable and relative
    date parsing (like '2 days ago') in the future z<014sz%Y%m%d%H%M%S)r�strptime)�dates r*�
_format_sincer0?s��
����U�|�n�=�=r,)�auto�always�neverc���eZdZdZdZdZidd�dd�dd�dd	�d
d�dd�d
d�dd�dd	�dg�dg�dg�dd�dd�dd�dg�dd�idg�dd�dg�dd	�dd�dd�d d�d!d"�d#d�d$d%�d&g�d'g�d(g�d)d�d*d�d+d�d,d��id-d�d.d	�d/g�d0d�d1e�d2e�d3g�d4d�d5d�d6d�d7g�d8d�d9d�d:d�d;d�d<d�d=d��ddddddddd	d	d>�
�Z�fd?�Ze	d@��Z
e	dA��ZdB�ZdC�Z
dD�ZdE�ZdF�ZdG�ZdH�ZdI�ZdJ�Zd~dK�ZdL�ZdM�ZdN�ZdO�ZdP�ZdQ�ZdR�ZdS�ZedT��ZddU�Z dV�Z!dW�Z"dX�Z#dY�Z$dZ�Z%d[�Z&d�d\�Z'd]�Z(d^�Z)d_�Z*d`�Z+da�Z,db�Z-dc�Z.dd�Z/de�Z0df�Z1dg�Z2d�dh�Z3di�Z4dj�Z5dk�Z6dl�Z7dm�Z8dn�Z9do�Z:dp�Z;dq�Z<dr�Z=ds�Z>dt�Z?du�Z@dv�ZAdw�ZBdx�ZCdy�ZDdz�ZEd{�ZFd|�ZGd}�ZH�xZIS)��	SoSReportzaRun a set of commands and file collections and save them to a report for
    future analysis
    z.Collect files and command output in an archiveT�
alloptionsF�all_logs�build�case_idr�chrootr1�clean�container_runtime�keep_binary_files�desc�domains�disable_parsers�skip_cleaning_files�dry_run�
estimate_only�experimental�enable_plugins�journal_size�d�keywords�keyword_fileN�plugopts�label�list_plugins�list_presets�
list_profiles�log_size��low_priority�map_file� /etc/sos/cleaner/default_mapping�
skip_commands�
skip_files�skip_plugins�
namespaces�	no_report�no_env_vars�no_postproc�	no_update�note�only_plugins�preset�plugin_timeout�cmd_timeout�profiles�since�verify�allow_system_changes�	usernames�upload�
upload_url�upload_directory�upload_user�upload_pass�
upload_method)
�upload_no_ssl_verify�upload_protocol�upload_s3_endpoint�upload_s3_region�upload_s3_bucket�upload_s3_access_key�upload_s3_secret_key�upload_s3_object_prefix�
add_preset�
del_presetc�<��t�|�|||�g|_g|_g|_t�|_||_d|_i|_	|j�|j�|jj�|_|jj j#d�|_|j'�d}|jj|_|j(jrd}n9|jj+�r|jt,j.k7rd}|j0j3d|j�d|�d��|j(j4t6vrq|j0j9d	|j(j4���t;j<�|j>jA�|jCd
�|jE�|jG�|jI�y)N�/�report�default�cmdline�policyzset sysroot to 'z' (�)zinvalid chroot mode: �)%�super�__init__�loaded_plugins�skipped_plugins�all_options�set�env_vars�_args�sysroot�estimated_plugsizes�print_header�
_set_debugr{�is_root�_is_root�manifest�
components�add_section�	report_md�_set_directories�opts�in_container�osr%�soslog�debugr:�chroot_modes�error�logging�shutdown�
tempfile_utilr;�_exit�_check_container_runtime�_get_namespaces�_get_hardware_devices)�self�parser�argsrz�msg�	__class__s     �r*rzSoSReport.__init__�s����
�����w�/� ���!���������
���
����#%�� ������������+�+�-��
����1�1�=�=�h�G����������{�{�*�*����9�9����C�
�[�[�
%�
%�
'�D�L�L�B�F�F�,B��C������,�T�\�\�N�#�c�U�!�D�E��9�9���<�/��K�K��� 5�d�i�i�6F�6F�5G�H�I��������$�$�&��J�J�q�M��%�%�'������"�"�$r,c
�*�|jdd�}|jdddddd�	�|jd
dddd�	�|jd
dddtd��|jddddd�	�|jdddd��|jdddddd�	�|jddd� �|jd!d"tdd#d$�%�|jd&dd'�(�|jd)dd*�(�|jd+dd,dd-�	�|jd.d/d0d1td2g�3�|jd4td5d6d7�8�|jd9d:d;d0d<td=g�3�|jd>d?dd@dA��|jdBdCddDddE�	�|jdFddG�(�|jdHddIddJ�	�|jdKddLtdMdN�O�|jdPdddQ�R�|jdSddT� �|jdUdVd0dWtdXg�3�|jdYddZdd[�	�|jd\dd]dd^�	�|jd_dd`dda�b�|jdctdd#dd�%�|jdedfd0dgtdhg�3�|jdidtdjd�k�|jdlddm� �|jdnddo� �|jdpdqdrd0dstgdt�O�|jdugd0dvdw�x�|jdygd0dzd{�x�|jd|dd}dd~�	�|jddd�dd��	�|jd�ddd��R�|jd�dd�� �|jd�dd�� �|jd�dd�� �|jd�dd�� �|jd�dgd��d����|jd�ddd����|jd�dd�� �|jd�dd�� �|jd�dd�� �|jd�dd�� �|jd�dd�� �|jd�dd�� �|jd�dgd��d����|j�}|jd�tdd����|jd�tdd����|jd�d��}|jd�d�d�d�ddd����|jd�d�gd0d����|jd�d0gd�d����|jd�d�d0gd�d����|jd�d0gd�d����|jd�dd�d����|jd�ddd�dì��|jd�d�d�dǬȫ|jd�ddd�dˬx�|jd�d�gd0dά��y)�NzReport Optionsz.These options control how report collects dataz-az--alloptions�
store_truer6Fz%enable all options for loaded plugins)�action�destry�helpz
--all-logsr7z-collect all available logs regardless of sizez--since�storerbzbEscapes archived files older than date. This will also affect --all-logs. Format: YYYYMMDD[HHMMSS])r�r�ry�typer�z--buildr8z;preserve the temporary directory and do not package resultsz	--case-idr9zspecify case identifier)r�r�r�z-cz--chrootr:r1zHchroot executed commands to SYSROOT [auto, always, never] (default=auto)z--container-runtimezLDefault container runtime to use for collections. 'auto' for policy control.)ryr�z--descz
--descriptionrzDescription for a new preset)r�r�ryr�z	--dry-runz#Run plugins but do not collect data)r�r�z--estimate-onlyzzApproximate disk space requirements for a real sos run; disables --clean and --collect, sets --threads=1 and --no-postprocz--experimentalrDzenable experimental pluginsz-ez--enable-plugins�extendrEzenable these plugins)r�r�r�r�ryz--journal-sizerGrFz+limit the size of collected journals in MiB)r�ryr�r�z-kz--plugin-optionz
--plugoptsrJz7plugin options in plugname.option=value format (see -l)z--labelz--namerKz"specify an additional report labelz-lz--list-pluginsrLz)list plugins and available plugin optionsz--list-presetsz#display a list of available presetsz--list-profilesrNzBdisplay a list of available profiles and plugins that they includez
--log-sizerOrPz6limit the size of collected logs (not journals) in MiB)r�r�r�ryr�z--low-priorityz(generate report with low system priority)r�ryr�z--namespaceszDlimit number of namespaces to collect output for - 0 means unlimitedz-nz--skip-pluginsrVzdisable these pluginsz--no-reportrXz disable plaintext/HTML reportingz
--no-env-varsrYz$Do not collect environment variablesz
--no-postprocrZzDisable all post-processing)ryr�r�r�z--notezBehaviour notes for new presetz-oz--only-pluginsr]zenable these plugins onlyz--presetzA preset identifier)r�r�r�ryz--plugin-timeoutzset a timeout for all pluginsz
--cmd-timeoutz%set a command timeout for all pluginsz-pz	--profilez
--profilesraz)enable plugins used by the given profilesz--skip-commandsrTzdo not execute these commands)ryr�r�r�z--skip-filesrUzdo not collect these filesz--verifyrcz+perform data verification during collectionz--allow-system-changesrdzJRun commands even if they can change the system (e.g. load kernel modules)z--uploadz+Upload archive to a policy-default locationz--upload-urlz&Upload the archive to specified serverz--upload-directoryz$Specify upload directory for archivez
--upload-userz'Username to authenticate to server withz
--upload-passz'Password to authenticate to server withz--upload-method)r1�put�postz HTTP method to use for uploading)ry�choicesr�z--upload-no-ssl-verifyz'Disable SSL verification for upload url)ryr�r�z--upload-s3-endpointz#Endpoint to upload to for S3 bucketz--upload-s3-regionz!Region to upload to for S3 bucketz--upload-s3-bucketz"Name of the S3 bucket to upload toz--upload-s3-access-keyzAccess key for the S3 bucketz--upload-s3-secret-keyzSecret key for the S3 bucketz--upload-s3-object-prefixzPrefix for the S3 object/keyz--upload-protocol)r1�https�ftp�sftp�s3z$Manually specify the upload protocol�--add-presetz#Add a new named command line preset)r�r�r�z--del-presetz$Delete the named command line presetzCleaner/Masking Optionsz7These options control how data obfuscation is performedz--cleanz	--cleanerz--maskr;zObfuscate sensitive information)r�ryr�r�z	--domainsr?z$Additional domain names to obfuscatez--disable-parsersr@zCDisable specific parsers, so that those elements are not obfuscated)r�ryr�r�z--skip-cleaning-filesz--skip-masking-filesrAzBList of files to skip/ignore during cleaning. Globs are supported.z
--keywordsrHzList of keywords to obfuscatez--keyword-filerIz&Provide a file a keywords to obfuscate)ryr�r�z--no-updater[z%Do not update the default cleaner mapz
--map-filerRrSz;Provide a previously generated mapping file for obfuscation)r�ryr�z--keep-binary-filesr=zGKeep unprocessable binary files in the archive instead of removing themz--usernamesrezList of usernames to obfuscate)�add_argument_group�add_argumentr0�str�int�add_mutually_exclusive_group)�clsr��
report_grp�
preset_grp�cleaner_grps     r*�add_parser_optionszSoSReport.add_parser_options�s=���.�.��<��
�	����n�\�%1�5�%L�	 �	N�	����\�%/��&/�	 �	0�	���	�'�%,�d��&@�	 �	A�
	���	�,�%,�e�&;�	 �	<�	����G�)�%>�	 �	@�����j��%-�v�&L�	 �	M�	��� 5�v�&O�	 �	P�	����/��'.��%C�	 �	F�	����L�%J�	 �	L���� 1�,�&5�	 �	6�
	��� 0��%3�U�%B�	 �	D�	����&8��%5�C�%;�R�	 �	I�	��� 0�s�C�%3�&.�	 �	/�	����&7��'/�%/�c�&7�@B�		 �	D�
	���	�8�G�%,�%I�	 �	K�	����&6�|�%3�U�&/�	 �	0�	��� 0��%J�	 �	L���� 1�,�%4�e�&B�	 �	C�	����W�:�%(�"�&=�	 �	>�	��� 0��(-�%O�	 �	"�	�����&F�	 �	G�	����&6�x�%3�#�%<�b�	 �	J�	���
�l�%0�%�%G�	 �	I�	�����%2�E�%K�	 �	M�	�����%2�<�%B�	 �	D�	����s�7�B�%E�	 �	G�����&6�x�%3�#�%@�"�	 �	N�	���
�7��%:�F�	 �	L���� 2�D�%D�	 �	F������%L�	 �	N�����k�<�'/�j�s�(*�&0�	 �	1�
	��� 1�2�h�%4�%D�	 �	F�	�����8�%1�%A�	 �	C�	���
�<�%-�u�&2�	 �	3�	��� 8��%;�U�&J�	 �	K�	���
�<��&0�	 �	1�	�����%M�	 �	O���� 4�d�%K�	 �	M������%N�	 �	P������%N�	 �	P���� 1�6�(?�%G�	 �	I�	��� 8�%�'3�%N�	 �	P�	��� 6��%J�	 �	L���� 4�d�%H�	 �	J���� 4�d�%I�	 �	K���� 8�$�%C�	 �	E���� 8�$�%C�	 �	E���� ;�T�%C�	 �	E���� 3�V�)/�%K�	 �	M� �<�<�>�
�����S��%J�	 �	L�����S��%K�	 �	M��/�/�%�E�
��	� � ��K��&-�).�|�&G�	!�	I�	� � ��9�b�(0�&L�	!�	N�	� � �!4�X�)+�2C�(K�	!�	M�	� � �!8�!7��)+�2G�(H�	!�	J�
	� � ��h��&0�&E�	!�	G�	� � �!1�4�&4�&N�	!�	P�	� � ��|�).�[�&M�	!�	O�	� � ��J�)K�(?�	!�	A�	� � �!6��(4�&9�'I�	!�	J�
	� � ��[�"�(0�&F�	!�	Hr,c�:�|jd�|jd�|jd�|jd�|jd��}|jd�|jd�|jd	��}|jd
td��dtd
����|jdtd��d��dddd�}d}|j	�D]\}}|jd|d�|��d��� |j|�y)NzSoS Report Detailed Helpz�The report command is the most common use case for SoS, and aims to collect relevant diagnostic and troubleshooting data to assist with issue analysis without actively performing that analysis on the system while it is in use.z�Additionally, sos report archives can be used for ongoing inspection for pre-emptive issue monitoring, such as that done by the Insights project.z�The typical result of an execution of 'sos report' is a tarball that contains troubleshooting command output, copies of config files, and copies of relevant sections of the host filesystem. Root privileges are required for collections.zHow Collections Are Determined)�titlez�SoS report performs its collections by way of 'plugins' that individually specify what files to copy and what commands to run. Plugins typically map to specific components or software packages.aFPlugins may specify different collections on different distributions, and some plugins may only be for specific distributions. Distributions are represented within SoS by 'policies' and may influence how other SoS commands or options function. For example policies can alter where the --upload option defaults to or functions.zSee Alsoz5For information on available options for report, see zsos report --helpz and zman sos-reportzThe following zsos helpz sections may be of interest:
z'Information on the plugin design of sosz!Information on a specific $pluginz+How sos operates on different distributions)zreport.pluginszreport.plugins.$plugin�policiesr�	z<36F)r()�	set_title�add_textr�r	r#)r��section�psec�ssec�
help_lines�helpln�ln�values        r*�display_helpzSoSReport.display_help�sN�����4�5����
.�	
�	���
'�	
�	���
<�	
��"�"�)I�"�J���
�
�
�	
�	
�
�
�
�	
��"�"��"�4���
�
�C��'�(�)��t�4D�/E�.F�
H�	
�	
�
�
��t�J�'7�&8�9$�$�	%�H�&I�E�
�
�
��#�)�)�+�	?�I�B���M�M�B�r�#�h�u�g�.��M�>�	?��
�
�f�r,c�D�tdtdt�d���d��y)N�
zsos report (version r|)�print�_r�r�s r*r�zSoSReport.print_header�s#��
��1�+�K�=��:�;�<�B�?�@r,c��|j�|j�d�|j�|j�|j	�d�|_y)N)�block�fibre)�storage�network�namespaced_network�fstype)�_get_block_devs�_get_fibre_devs�_get_network_devs�_get_network_namespace_devices�_get_devices_by_fstype�devicesr�s r*r�zSoSReport._get_hardware_devices�sP���-�-�/��-�-�/���-�-�/�"&�"E�"E�"G��1�1�3�
��r,c��|jjdk7�ro|jjj�}|dvr-i|j_|j
j
d�y
|jjs"d|�d�}|j
j|�y
||jjj�vrKdjd�|jjj�D��}td|�d	|����|jj||jjd
<|j
j
d|jjd
j�d��y
y
)a[Check the loaded container runtimes, and the policy default runtime
        (if set), against any requested --container-runtime value. This can be
        useful for systems that have multiple runtimes, such as RHCOS, but do
        not have a clearly defined 'default' (or one that is determined based
        entirely on configuration).
        r1)�none�off�diabledz0Disabled all container runtimes per user option.zVWARNING: No container runtimes are active, ignoring option to set default runtime to '�'
�, c3�*K�|]}|dk7r|���
y�w)ryN���.0�ps  r*�	<genexpr>z5SoSReport._check_container_runtime.<locals>.<genexpr>�s����"5��%&�)�^�#$�"5�s�zCannot use container runtime 'z1': no such runtime detected. Available runtimes: ryz"Set default container runtime to '�'N)r�r<�lowerr{�runtimesr��info�warning�keys�join�	Exception�name)r��crunr��valids    r*r�z"SoSReport._check_container_runtime�s^���9�9�&�&�&�0��9�9�.�.�4�4�6�D��1�1�')����$���� � �F���[�[�)�)�<�<@�6��F�����#�#�C�(��T�[�[�1�1�6�6�8�8��	�	�"5�T�[�[�-A�-A�-F�-F�-H�"5�5���"@���GN�#(�'�!+�,�,�37�+�+�2F�2F�t�2L����$�$�Y�/���� � �����,�,�Y�7�<�<�=�Q�@��'1r,c�$�	g}gd�}|D]M}tjjd|���s�&|jt	jd|�d����O|S#t
$r*}|jjd|���gcYd}~Sd}~wwxYw)z�Enumerate a list of fibrechannel devices on this system so that
        plugins can iterate over them

        These devices are used by add_device_cmd() in the Plugin class.
        )�fc_host�fc_transport�fc_remote_ports�	fc_vportsz/sys/class/z/*z!Could not get fibre device list: N)r��path�isdirr��globr�r�r�)r��devs�devdirs�devdir�errs     r*r�zSoSReport._get_fibre_devs�s���	��D��G�"�
E���7�7�=�=�;�v�h�!7�8��K�K��	�	�K��x�r�*B� C�D�
E��K���	��K�K��� A�#��G�H��I��	�s"�-A�+A�	B�%B
�B�
Bc��	tjd�D�cgc]}d|����	}}td�}g}|ddk(rL|dj�D]6}|j	�djdd�}|j
|��8|D�cgc]}|jd	�r||vr|��}}tt|�t|�z
�}	|	Scc}wcc}w#t$r*}
|jjd
|
���gcYd}
~
Sd}
~
wwxYw)z�Enumerate a list of block devices on this system so that plugins
        can iterate over them

        These devices are used by add_device_cmd() in the Plugin class.
        z
/sys/blockz/dev/zlosetup --all --noheadings�statusr�output�:r�loopz!Could not get block device list: N)
r�rr
�
splitlines�split�replacer!�
startswith�listr�r�r�r�)r��d�device_list�loop_devices�real_loop_devices�loop_dev�loop_device�dev�ghost_loop_devs�dev_listrs           r*r�zSoSReport._get_block_devss#��	�02�
�
�<�0H�I�1�U�1�#�;�I�K�I�1�2N�O�L� "���H�%��*� ,�X� 6� A� A� C�:�H�"*�.�.�"2�1�"5�"=�"=�c�2�"F�K�%�,�,�[�9�:�/:�@�s�"%�.�.��"8�"%�->�">� #�@�O�@��C��,�s�?�/C�C�D�H��O��J��@��
�	��K�K��� A�#��G�H��I��	�s:�C�C�A'C�C�*#C�
C�	D�!D�D�Dc�2�d|j�i|_y)Nr�)�_get_network_namespacesrWr�s r*r�zSoSReport._get_namespacess���t�3�3�5�
��r,c��ggggd�}	td|jj��r|j|j	��|dsM|j
j
d�|j|j��|j�|d<|S#t$r)}|j
jd|���Yd}~|Sd}~wwxYw)	aHelper to encapsulate network devices probed by sos. Rather than
        probing lists of distinct device types like we do for storage, we can
        do some introspection of device enumeration where a single interface
        may have multiple device types. E.G an 'ethernet' device could also be
        a bond, and that is pertinent information for device iteration.

        :returns:   A collection of enumerated devices sorted by device type
        :rtype:     ``dict`` with keys being device types
        )�ethernet�bridge�team�bond�nmcli)r�rzZNetwork devices not enumerated by nmcli. Will attempt to manually compile list of devices.rz%Could not enumerate network devices: N)r
r�r��update�_get_nmcli_devsr�r��
_get_eth_devs�_get_bridge_devsr�r�)r��_devsrs   r*r�zSoSReport._get_network_devss�������	
��	O��W�d�i�i�.?�.?�@����T�1�1�3�4���$����!�!�8�����T�/�/�1�2�"&�"7�"7�"9��h������	O��K�K���"G��u� M�N�N����	O�s�BB�	C�&C
�
Cc�^�i}|jdD]}d|j|�i||<�|S)zqEnumerate the network devices that exist within each network
        namespace that exists on the system
        r�r)rWr)r��_nmdevs�nmsps   r*r�z(SoSReport._get_network_namespace_devices=sC�����O�O�I�.�	�D��D�.�.�t�4��G�D�M�	��r,c��i}	td�}|ddk(ra|dj�ddD]H}|j�\}}||vr|g||<n||j|�|dj|��Jt	t|d��|d<|S#t$r)}|jjd|���Yd}~|Sd}~wwxYw)	z�Use nmcli, if available, to enumerate network devices. From this
        output, manually grok together lists of devices.
        znmcli --fields DEVICE,TYPE devrrrr}NrzCould not parse nmcli devices: )	r
rrr!r
r�r�r�r�)r�r �_ndevsr�dname�dtypers       r*rzSoSReport._get_nmcli_devsHs�����	G�+�,L�M�F��h��1�$�!�(�+�6�6�8���<�4�C�#&�9�9�;�L�E�5��E�)�(-�w��e���e��+�+�E�2��*�%�,�,�U�3�
4�!%�S��z�):�%;� <�E�*������	G��K�K��� ?��u�E�F�F����	G�s�BB�	C�C�Cc�^�dg}g}|s	tdd�D�cgc]}||vr|��
}}nH	d|�d�}t	|�}|ddk(r.|d	j�D]}||vs�|j
|��||D�	cgc]}	|	jd�s�|	��c}	|D�
cgc]}
|
jd
�s�|
��c}
d�Scc}w#t$r(}|jjd|���Yd}~�wd}~wwxYw#t$r+}|jjd
|�d|���Yd}~��d}~wwxYwcc}	wcc}
w)a8Enumerate a list of ethernet network devices so that plugins can
        reliably iterate over the same set of devices without doing piecemeal
        discovery.

        These devices are used by `add_device_cmd()` when `devices` includes
        "ethernet" or "network".

        :param namespace:   Inspect this existing network namespace, if
                            provided
        :type namespace:    ``str``

        :returns:   All valid ethernet devices found, potentially within a
                    given namespace
        :rtype:     ``list``
        �bonding_mastersz/sys/class/netNz.Failed to manually determine network devices: zip netns exec z ls /sys/class/netrrrz'Could not determine network namespace 'z' devices: r�tun)rrr*)rr�r�r�r
rr!r	)r��	namespace�	filt_devs�	_eth_devsrr�_nscmd�_nsout�_nseth�bd�tds           r*rzSoSReport._get_eth_devs\sf�� '�'�	��	��
�
$+�+;�T�#B����)�+���	��
�)�)��4F�G��/��7���(�#�q�(�"(��"2�"8�"8�":�5��!��2�%�,�,�V�4�5�"�"+�E�B�r�}�}�V�/D�R�E�!*�C�2�b�m�m�E�.B�B�C�
�	
��+���
����#�#�D�S�E�J����
���
����#�#�=�i�[�I � #�u�&����
��F��Cs\�B:�
B5�B:�3C.�C.�4D%�D%�D*�,D*�5B:�:	C+�C&�&C+�.	D"�7!D�D"c��g}	tdd��}ddk(r>|dj	�d	dD]%}	|j|j
�d��'|S#t$r(}|jjd|���Yd}~�td}~wwxYw#t$r+}|jjd
|�d|���Yd}~��d}~wwxYw)z�Enumerate a list of bridge devices so that plugins can reliably
        iterate over the same set of bridges.

        These devices are used by `add_device_cmd()` when `devices` includes
        "bridge" or "network".
        z
brctl show���timeoutz$Unable to enumerate bridge devices: Nrrrr}z"Could not parse device from line 'z': )r
r�r�r�rr!rr�)r��_bridges�_boutr�_blines     r*rzSoSReport._get_bridge_devs�s�����	N�*�<��D�E���?�a����/�4�4�6�q�r�:�
����O�O�F�L�L�N�1�$5�6�
�����	N��K�K���"F�s�e� L�M�M��	N��!���K�K�$�$�<�V�H�C��u�M�����s.�
A�"B
�	B
�"B�B
�
	C�!B<�<Cc���g}td�}|ddk(r_|dj�D]I}|j�s|ddj�r�'|j|j	d�d��K|S)z�Enumerate a list of network namespaces on this system so that
        plugins can iterate over them

        Note that stderr is not collected, so no handling of error lines.
        zip netnsrrrNr}r)r
r�isspacer!�	partition)r��out_ns�ip_netnsr's    r*rz!SoSReport._get_network_namespaces�s{����)�*�5���H���"� ��*�5�5�7�
6���<�<�>�T�"�1�X�%5�%5�%7���
�
�d�n�n�S�1�!�4�5�
6��
r,c�V�i}td�}|ddk7r|S|dj�D]{}|j�j�}t	|�dk(r|jdd�d|dvrd|d<|j
|dg�||dj|d��}|S)	Nzlsblk -snrpo FSTYPE,NAMErrrr}�unknown�ext�ext4)r
r�striprr �insert�
setdefaultr!)r��_dev_fstypesr r'�helpers     r*r�z SoSReport._get_devices_by_fstype�s�����&�'A�B����?�a�����8�_�/�/�1�	6�D��Z�Z�\�'�'�)�F��6�{�a���
�
�a��+���q�	�!�"��q�	��#�#�F�1�I�r�2�����#�*�*�6�!�9�5�	6��r,c��|j|j|j|j|j|j
|j|jj|j|j|jd�S)N)�cmddir�logdir�rptdir�tmpdirr�r{r��	verbosity�cmdlineoptsr�rW)rIrJrKrLr�r{r�r�rMr�rWr�s r*�get_commonszSoSReport.get_commons�s_���k�k��k�k��k�k��k�k��k�k��k�k��|�|����,�,��9�9��|�|��/�/�
�	
r,c�6�|jj�S�N)r��newr�s r*�
get_temp_filezSoSReport.get_temp_file�s���!�!�%�%�'�'r,c���|jj|jd�|jj|jd�|jj|jd�y)Ni�)�archive�makedirsrIrJrKr�s r*�_make_archive_pathszSoSReport._make_archive_paths�sJ�������d�k�k�5�1������d�k�k�5�1������d�k�k�5�1r,c�.�d|_d|_d|_y)N�sos_commands�sos_logs�sos_reports)rIrJrKr�s r*r�zSoSReport._set_directories�s��$��� ���#��r,c�x�|jjr|jt_d|_yd|_y)NTF)r�r��
_exception�sys�
excepthook�
raise_pluginsr�s r*r�zSoSReport._set_debug�s(���9�9�?�?�!�_�_�C�N�!%�D��!&�D�r,c��ttd�stjj�stj|||�ytj|||dtj��t�tj�y)z* Wrap exception in debugger if not in tty �ps1�)�limit�fileN)�hasattrr^�stderr�isatty�__excepthook__�	traceback�print_exception�stdoutr��pdb�pm)�etype�eval_�etraces   r*r]zSoSReport._exception�s^���3���c�j�j�&7�&7�&9�
���u�e�V�4�
�%�%�e�U�F�!�+.�:�:�
7��G��F�F�Hr,c� �|js|jr^tj�\}}}t	j
|||tj��t�tj|�|r|r|j||�yyy)N)re)r`�exit_processr^�exc_inforjrkrlr�rm�post_mortem�_log_plugin_exception)r��plugname�funcro�val�tbs      r*�handle_exceptionzSoSReport.handle_exception�sj������!2�!2�"�|�|�~��U�C���%�%�e�S�"�3�:�:�F��G��O�O�B�����&�&�x��6��8r,c�N�t|dd�rE|jj|jtj
j
dd���t|dd�rF|jj|jtj
j
dd���yy)N�sos_log_filerZ�sos.log�r��sos_ui_log_file�ui.log)�getattrrU�add_filer}r�r�r�r�r�s r*�
_add_sos_logszSoSReport._add_sos_logss���
�4���.��L�L�!�!�$�"3�"3�')�w�w�|�|�J�	�'J�
"�
L��4�*�D�1��L�L�!�!�$�"6�"6�')�w�w�|�|�J��'I�
"�
K�2r,c����jj}�jjsyt|d�sy|r �j	|j��syt
�fd�|jD��S)NTraFc3�N�K�|]}|�jjv���y�wrQ)r�ra)r�r�r�s  �r*r�z+SoSReport._is_in_profile.<locals>.<genexpr>s �����J�q�1��	�	�*�*�*�J�s�"%)r�r]rarf�_is_not_specifiedr��any)r��plugin_classr]s`  r*�_is_in_profilezSoSReport._is_in_profile
sb����y�y�-�-���y�y�!�!���|�Z�0���� 6� 6�|�7H�7H�7J� K���J�L�4I�4I�J�J�Jr,c�2�||jjvSrQ)r�rV�r��plugin_names  r*�_is_skippedzSoSReport._is_skippeds���d�i�i�4�4�4�4r,c��||j��j�xr2||jjvxr||jjvSrQ)rO�
check_enabledr�rEr]�r�r��pluginClasss   r*�_is_inactivezSoSReport._is_inactivesR���� 0� 0� 2�3�A�A�C�C�:��4�9�9�#;�#;�;�:��4�9�9�#9�#9�9�	;r,c��||j��j�xr2||jjvxr||jjvSrQ)rO�default_enabledr�rEr]r�s   r*�_is_not_defaultzSoSReport._is_not_defaultsR���� 0� 0� 2�3�C�C�E�E�:��4�9�9�#;�#;�;�:��4�9�9�#9�#9�9�	;r,c�b�|jjxr||jjvSrQ)r�r]r�s  r*r�zSoSReport._is_not_specified$s+���	�	�&�&�:��4�9�9�#9�#9�9�	;r,c��|jj|j�||j��|f�yrQ)r�r!r�rO)r�r��reasons   r*�_skipzSoSReport._skip(s;�����#�#�������)�)�+�,��%
�	r,c��|jj|j�||j��f�yrQ)r�r!r�rO)r�r�s  r*�_loadzSoSReport._load/s8�����"�"�������)�)�+�,�$
�	r,c
�\�tjjj}t	tjj�}|j�}g|_t�|_t|jj�}|jj}g}|jjr3|jtjjj�t!||z�}|jj"}t%|jj�}	|D�]?}
t&j(j+|
�\}}	|||�}
|
s�3|jj-|
�}|||jj��s]|j.j1t3d|
�d���|jj4dkDr|j7|t3d����|jj|�|j9|�}|s|j7|t3d����|j;|�r|j7|t3d����B|j=||�r|j7|t3d����q|j?||�r|j7|t3d	�����tA|d
�r%|jjC|j�|xr|}|jE|�r|r|j7|t3d����|jD]}||	vs�|	jG|��|jI|���Bt|	�dkDrX|j.jOt3d
djQ|	�����|jS�|jUd�yy#tJ$rE}|j.j1t3d|
�d|����|jM�Yd}~���d}~wwxYw)N)rDzplugin z does not validate, skippingrzdoes not validate�excluded�skipped�inactive�optionalraz
not specifiedz does not install, skipping: z)Unknown or inactive profile(s) provided: r�r})+�sosrx�plugins�
import_pluginr�get_modules�plugin_namesr�rar r�r{�valid_subclassesrDr!�ExperimentalPlugin�tuple�validate_pluginr
r�r��splitext�match_pluginr�r�r�rMr�r�r�r�r�rfrr��remover�r�r{r�r�rNr�)r�r�rGr��using_profiles�policy_classes�
extra_classes�valid_plugin_classesr��remaining_profiles�plug�plugbase�__�plugin_classesr��
in_profile�default_profile�i�es                   r*�load_pluginszSoSReport.load_plugins5s}���
�
�*�*�8�8�
���
�
� 2� 2�3���$�$�&��������
��T�Y�Y�/�/�0�����5�5���
��9�9�!�!�� � ����!3�!3�!F�!F�G�$�^�m�%C�D���+�+�5�5��!�$�)�)�"4�"4�5���7	(�D��7�7�+�+�D�1�L�H�b�5
(�!.�x�9M�!N��%��#�{�{�7�7��G��&�|�48�I�I�4J�4J�L��K�K�'�'��G�D�6�)E�F�G�I��y�y�*�*�Q�.��
�
�<��3F�1G�H� ��!�!�(�(��2�!�0�0��>�
�!��J�J�|�Q�z�]�;���#�#�H�-��J�J�|�Q�y�\�:���$�$�X�|�<��J�J�|�Q�z�]�;���'�'��,�?��J�J�|�Q�z�]�;���<��4��M�M�(�(��)>�)>�?�'5�"4�"C����)�)�(�3���J�J�|�Q��-?�@��%�.�.�5�A��.�.�*�1�1�!�4�5��
�
�<�(�g7	(�p�!�"�Q�&��K�K���a�!$�$(�I�I�.@�$A�#B�!D�E�
F���� ��J�J�q�M�	'��	�
(����#�#�A���v�63�34�#�'7�%8�9��%�%�'�'��
(�sK�O�&BO�<A	O�,O�5-O�$-O�A&O�;O�$O�	P+�&:P&�&P+c���|jjrN|jD]>\}}|jj	�D]}t
|jvs�d|_��@yy)NT)r�r6r��options�values�bool�val_typer�)r�r�r��opts    r*�_set_all_optionszSoSReport._set_all_options�s\���9�9��� �/�/�
)���D��<�<�.�.�0�)�C��s�|�|�+�$(��	�)�
)� r,c	��|jj�r�i}|jjD]t}	|jd�\}}t	|t
�r*|j
�}|dvrd}n|dvrd}n	t|�}	|jd�\}}	||||||<�v|jD]�\}}||vs�||D]�}||jvr3|jjd|�d|�d	��|jd
�	|j|j|||�|jjd|�d|j|�����||=��|D]!}|jjd
|�d���#|j#�r|jjd�yyy#t$rd}Y��{wxYw#t$rY��QwxYw#t$r|}d}Y��PwxYw#t$r	i||<Y��_wxYw#t $r7}|jj|�|jd
�Yd}~��xd}~wwxYw)N�=T)�on�enable�enabled�true�yes)r��disable�disabled�false�noF�.zno such option "z" for plugin (r|r}zSet z plugin option to zCWARNING: unable to set option for disabled or non-existing plugin (z).r)r�rJr�
ValueError�
isinstancer�r�r��KeyErrorr�r�r�r�r��	set_valuer�r�r�)r�r�r�ryr�rwrs       r*�
_set_tunableszSoSReport._set_tunables�sz���9�9����D��y�y�)�)�
&���"�y�y��~�H�C���c�3�'��)�)�+�C��H�H�"��� M�M�#��!�"%�c�(�C�
� #�	�	�#��I�D�#�
$���J�#&��T�
�3��=
&�@#'�"5�"5�
'���$��t�#�#�H�~�*���d�l�l�2� �K�K�-�-�0@���F9�9A�
�!�/E�F� �J�J�q�M�*� �L�L��-�7�7��X��s�8K�L� �K�K�-�-�"&�x�j�0B�#'�<�<��#4�"5�!7�8�*��X��
'� !�
K�����!�!�#=�=E�J�b�#J�K�
K�
�y�y�{����!�!�"�%��o��
"���C��� *�!� �!��"���D��C��� �$�!#�D��J�$��  )�*� �K�K�-�-�c�2� �J�J�q�M�M��*�s`�F5�7G�G�G+�AH�5G�G�	G�G�
G(�'G(�+G=�<G=�	I�	,H;�;Ic���ddl}|j|jj|jj�D]U}|jd�d}||jvs�&|jjd|�d��|jd��W|jjD]0}||jvs�|jjd|�d���2y)Nrr�za non-existing plugin (z$) was specified in the command line.r}z'Requested to skip non-existing plugin 'z'.)�	itertools�chainr�r]rErr�r��fatalr�rVr�)r�r��pluginr�s    r*�_check_for_unknown_pluginsz$SoSReport._check_for_unknown_plugins�s�����o�o�d�i�i�&<�&<�&*�i�i�&>�&>�@�	�F� �,�,�s�+�A�.�K��$�"3�"3�3����!�!�$;�K�=�IC�#C�D��
�
�1�
�
	��i�i�,�,�	�F��T�.�.�.����#�#�=�f�X�R�H��	r,c��|jD]>\}}|jD]*}|jj|j|��,�@yrQ)r�r�r�r!)r�r�r�r�s    r*�_set_plugin_optionszSoSReport._set_plugin_options�sK���-�-�	=�J�B���~�~�
=��� � �'�'����s�(;�<�
=�	=r,c�N�d}g}|jjdkDr/|d|jj�d�gz
}d|j_|jjs|dgz
}d|j_|jjs|dgz
}d|j_|jjr|dgz
}d	|j_|jj
r|d
gz
}d	|j_|r|ddj
|�zz
}n|d
z
}|dz
}|S)Nz
Estimate-only mode enabledr}z
--threads=z overriden to 1z--build enabledTz--no-postproc enabledz--clean disabledFz--upload* options disabledz", which overrides some options:
  z
  r�z

)r��threadsr8rZr;rfr�)r�r��ext_msgs   r*�_set_estimate_onlyzSoSReport._set_estimate_only�s��-�����9�9���q� ��*�T�Y�Y�%6�%6�$7��G�J�J�G� !�D�I�I���y�y����)�,�,�G�"�D�I�I�O��y�y�$�$��/�2�2�G�$(�D�I�I�!��9�9�?�?��*�-�-�G�#�D�I�I�O��9�9����4�7�7�G�$�D�I�I����8�6�;�;�w�;O�O�O�C��3�J�C��v�
���
r,c�~�|jjd�|jrI|jjdt|j��dt|j��d��n2|jjdt|j��d��|jjd�y)Nrrz profiles, z pluginsz	 profiles)�ui_logr�r�r rar�s r*�_report_profiles_and_pluginsz&SoSReport._report_profiles_and_plugins�s��������������K�K���q��T�]�]�!3� 4�K� #�D�$7�$7� 8�9��C�
D�
�K�K���q��T�]�]�!3� 4�I�>�?�������r,c
�	�|js1|js%|jjt	d��y|jr�|j
j
t	d��|j
j
d�|jD]5\}}|j
j
d|d�d|j�����7n$|j
j
t	d��|j
j
d�|jr�|j
j
t	d��|j
j
d�|jD]:\}}}|j
j
d|d�d|d�d|j�����<|j
j
d�|j�r|j
j
t	d	��|jd
dj�}|D]�}||}|j}|jdk(rN|d
k(r|jjxst}n*|dk(r|jjxst}nt}|jdk(r|jj }|j
j
d|jd�d|d�d|j"�����|j
j
d�|j
j
t	d��|jD]�}|jdvr|j|j$k(r�+t'|jt(�r|jdurd}	nd}	n|j}	|	�d
}	|j
j
d|j*�d|j��d�d|	d�d|j"�����n$|j
j
t	d��|j
j
d�t-|j.�}
|
j1�t3d|
d��}|D] }|j
j
d|����"|j5�y)Nzno valid plugins foundz,The following plugins are currently enabled:rrz<20zNo plugin enabled.z-The following plugins are currently disabled:z<14z4The following options are available for ALL plugins:rr}���r6�cmd-timeout�postprocz<25�<15z+The following plugin options are available:)r6r�r�Tr�r�r�zNo plugin options available.z
Profiles: �r$)r�r�r�r�r�r�r��get_descriptionr��get_default_plugin_optsr�r�r_rr`r�rZr>ryr�r�r�r
ra�sortr+r�)
r�rwr��	plugclassr��	_defaults�_optr�ry�tmpoptrar&r's
             r*rLzSoSReport.list_plugins�s����"�"�4�+?�+?��K�K���a� 8�9�:������K�K���Q�M�N�O��K�K���R� �$(�$7�$7�
N� ��4���� � �1�X�c�N�!�D�4H�4H�4J�3K�!L�M�
N�
�K�K���Q�3�4�5������������K�K���Q� +�,�
-��K�K���R� �15�1E�1E�
C�-��9�f���� � �1�X�c�N�!�F�3�<�q�$-�$=�$=�$?�#@�"B�C�
C�	
�����������K�K���Q� *�+�
,��+�+�A�.�q�1�I�I�K�I�!�
J����o���i�i���9�9��?��y�(�"�i�i�6�6�I�/����.�"�i�i�3�3�F���-���8�8�z�)�"�i�i�3�3�3�C���� � �1�S�X�X�c�N�!�C��9�A�c�h�h�Z�!H�I�
J�
�K�K���R� ��K�K���Q�L�M�N��'�'�
=���8�8�E�E��y�y�C�K�K�/� ��c�i�i��.��y�y�D�(�!%��!&�� �Y�Y�F��>��F���� � �1��
�
�|�1�S�X�X�J�%?��$D�A�$*�3�<�q����
�"<�=�!
=�&
�K�K���Q�=�>�?����������
�
�&���
�
���\�8�D�A���	)�D��K�K���q���Z�(�	)��)�)�+r,c�J�|js%|jjtd��y|jjtd��|jjd�d�}t
|j�}|j�|D]v}g}|jD].\}}||�s�||jvs�|j|��0t|d�|d��}|D] }|jjd|����"�x|j�y)	Nzno valid profiles foundz%The following profiles are available:rc��t|d�S)Nra)rf)�cs r*�	_has_profz*SoSReport.list_profiles.<locals>._has_profOs���1�j�)�)r,r�Tr�r)rar�r�r�r�r�r
r�r�r!r+r�)	r�r�ra�profiler�r�r�r&r's	         r*rNzSoSReport.list_profilesHs���}�}��K�K���a� 9�:�;��������B�C�D��������	*���
�
�&���
�
���	-�G��G� $� 3� 3�
)���f��V�$��F�O�O�)C��N�N�4�(�
)�!�G�C�=�7�4�H�E��
-����� � �1�T�F��,�
-�
	-�	
�)�)�+r,c��|jjs%|jjt	d��y|j
j
t	d��|j
j
d�|jjj�D�]3}|s�|jj|�}|j
j
dd�d|j���|j
j
dd�d|j���|jr+|j
j
dd�d|j���|jjd	kDrQ|jj�}d
d�d�}t||dd��}|D]}|j
j
|��|j
j
d���6y)
Nzno valid presets foundz$The following presets are available:rzname:z>14rzdescription:znote:rzoptions:T)r$r%)r{�presetsr�r�r�r�r�r��find_presetr�r>r\r�rM�to_argsr+)r�r^r��options_strr&r's      r*rMzSoSReport.list_presets^sw���{�{�"�"��K�K���a� 8�9�:��������A�B�C���������k�k�)�)�.�.�0�	!�F����[�[�,�,�V�4�F��K�K�����}�A�f�k�k�]�;�<��K�K����s�3�1�V�[�[�M�B�C��{�{���� � �G�C�=��&�+�+��!?�@��y�y�"�"�Q�&��{�{�*�*�,��!+�C� 0��2��$�[�$�t��M��!�+�D��K�K�$�$�T�*�+��K�K���R� �	!r,c�j�|j}|j|�r |jjd|�d��y|xs|jj
}|xs|jj}	|j||||j��|jjd�}|jd||j|d	zdz}|jjd
|�ddj|��d
��y#t$r(}|jjd|���Yd}~yd}~wwxYw)z�Add a new command line preset for the current options with the
            specified name.

            :param name: the name of the new preset
            :returns: True on success or False otherwise
        zA preset named 'z' already existsF)r�r>r\r�zCould not add preset: Nr�rrczAdded preset 'z' with options rr�T)
r{r�r�r�r�r>r\rtr�rz�indexr�r�)r�r�r>r\r{r��	arg_indexr�s        r*rtzSoSReport.add_presetvs���������d�#��K�K��� 0���6F�G�H���%�t�y�y�~�~���%�t�y�y�~�~��	����4�d��D�I�I��N��L�L�&�&�~�6�	��|�|�A�i�(�4�<�<�	�A�
��+G�G��������T�F�/�#�(�(�4�.�1A��D�	F����	��K�K��� 6�q�c�:�;���	�s�3D�	D2�
D-�-D2c�\�|j}|j|�s |jjd|�d��y	|j	|��|jjd|�d��y	#t
$r1}|jjt
|��d��Yd}~yd}~wwxYw)
z�Delete a named command line preset.

            :param name: the name of the preset to delete
            :returns: True on success or False otherwise
        zPreset 'z' not foundF�r�r�NzDeleted preset 'r�T)r{r�r�r�rur�r�r�)r�r�r{r�s    r*ruzSoSReport.del_preset�s��������!�!�$�'��K�K������k�:�;��	����4��(�
	
�����+�D�6��5�6����	��K�K����Q����m�,���	�s�A1�1	B+�:'B&�&B+c���|jj�}|jjr||j	�z
}|jj
r|jj|�y|td�z
}	t|�y#t$r/|jjd�|jd�Yyt$r}|jd|�Yd}~yd}~wwxYw)Nz,Press ENTER to continue, or CTRL-C to quit.
zExiting on user cancel�r})r{�get_msgr�rCr��batchr�r�r��input�KeyboardInterruptr�r�r�)r�r�r�s   r*rzSoSReport.batch�s����k�k�!�!�#���9�9�"�"��4�*�*�,�,�C��9�9�?�?��K�K���S�!��1�D�E�E�C�
!��c�
��$�
 ����!�!�":�;��
�
�3���
!��
�
�1�a� � ��
!�s�B�5C,�C,�C'�'C,c�T�tj�}d}|�d�}tjj	|j
|�}|jj|�d|�d|�d��|jjd|���|jj|�d�|d�	�y)
Nz!caught exception in plugin methodz-plugin-errors.txtz "r�z()"zwriting traceback to r��a)�mode)
rj�
format_excr�r�r�rJr�r�rU�
add_string)r�r��method�tracer��plugin_err_log�logpaths       r*rvzSoSReport._log_plugin_exception�s����$�$�&��1��"�8�#5�6���'�'�,�,�t�{�{�N�;�������S�E��F�8�1�V�H�C�8�9������1�'��;�<������5�'���g�C��@r,c��|jj�	|jjt	d��|j�|j
�y#t$r[}|jtvr0td�td|j�d��td�ntd|����Yd}~n~d}~wt$ro}|jjd�|jjd�tj�|jj|�Yd}~nd}~wwxYw|j!d�y)Nz Setting up archive ...rrz while setting up archivezError setting up archive: z) Unexpected exception setting up archive:r})r{�pre_workr�r�r��
setup_archiverW�OSError�errno�fatal_fs_errorsr��strerrorr�r�rj�	print_excr��r�r�s  r*�preworkzSoSReport.prework�s��������	!��K�K���Q�8�9�:���� ��$�$�&����
	��w�w�/�)��b�	���!�*�*��%>�?�@��b�	��2�1�#�6�7�����	!��K�K���b�!��K�K���I�J����!��K�K���a� � ��		!��
	
�
�
�1�
s&�AA!�!	D;�*AC�D;�A%D6�6D;c���|jjtd��|jD�]V\}}	|jj
j
|�|jt|jj
|��tj�}|jjd|�|j|_
|j�|j�|j j#|j$�|j&j(r|j+�tj�}|jjd|�|jjd||z
���Yy#t,$rt,�t.$r�}|j0t2vrp|jj5d�|jj5d|j6�d��|jj5d�|j9d�|j;|d	�Yd}~��d}~wt<$r|j;|d	�Y��-wxYw)
Nz Setting up plugins ...�setup_start�	setup_end�
setup_timerrz while setting up pluginsr}�setup)r�r�r�r�r�r�r��set_plugin_manifestr�r�nowr��	add_fieldrU�add_default_collectionsrr�r�	_env_varsr�rc�setup_verifyrrrrr�rr�r{r��r�rwr��start�endr�s      r*rzSoSReport.setup�s���������4�5�6�"�1�1�	9�N�H�d�
9����&�&�2�2�8�<��(�(�����1G�1G�19�*;�<� ������
�
�'�'�
�u�=�#�|�|����,�,�.��
�
���
�
�$�$�T�^�^�4��9�9�#�#��%�%�'��l�l�n���
�
�'�'��S�9��
�
�'�'��c�E�k�B�	9�� %�
(�'�'��
9��7�7�o�-��K�K�%�%�b�)��K�K�%�%��A�J�J�<�'@�A�C��K�K�%�%�b�)��J�J�q�M��%�%�h��8�8���
9��%�%�h��8�
9�s�EF�I�#BH=�=I�Ic��g}|jdt���|jjdj	|�d��y)zWFetch version information from all plugins and store in the report
        version filezsos report: r�zversion.txt)�contentr�N)r!rrUr	r�)r��versionss  r*�versionzSoSReport.version�sA�������,�{�m�4�5�������	�	�(�(;�%2�	 �	4r,c���|jjtd��|jjd�d}g|_g|_|j
D]'}|dz
}|jj
||df��)	g}t|jj�5}|j|jt|j��}ddd�|D]#}|r�|jjd|����%|jjd�y#1swY�MxYw#t$r3|jj!d�t#j$d�YywxYw)Nz! Running plugins. Please wait ...rrr}zUnexpected plugin task result: z
Exiting on user cancel
)r�r�r��pluglist�
running_plugsr�r!rr�r��map�_collect_pluginr
r�r�rr�r�r�)r��plugruncountr��results�executor�ress      r*�collectzSoSReport.collectsA��������>�?�@������������
�����$�$�	7�A��A��L��M�M� � �,��!��!5�6�	7�	��G�#�D�I�I�$5�$5�6�
<�(�"�,�,�t�';�';�'+�D�M�M�':�<��
<��
O����K�K�%�%�(G��u�&M�N�
O�
�K�K���R� �

<�
<��!�	��K�K���:�;��H�H�Q�K�	�s0�!D0�(0D$�D0�(;D0�$D-�)D0�09E,�+E,c���td�5}	|j|ddz
d}|j|j|�}|jxsd}tj�}|jjd|�|j|��tj�}|jjd|�|jjd||z
�ddd�|j*j,r�|j.j1�}		t3d|	���}
t5|
dj7�d�|j8|d<t=j>|	�D]�}t<j@jC|	|�}t<j@jE|�r+t<j@jG|�stI|��mt=jJ|���y#t$r�d|d�d	�}|jjd
|�d��|jj|�|jj!|d�|j|ddz
dj#�|j%d�
�|j&j)�Y���wxYw#1swY���xYw#t:$rd|j8|d<Y���wxYw)zaWraps the collect_plugin() method so we can apply a timeout
        against the plugin as a wholer}rN�
start_timer5�end_time�run_timezPlugin z
 timed out�
 r�T)�waitzdu -sB1 r)&rr��submit�collect_pluginr6rrr�r�result�FuturesTimeoutErrorr�r�r�r�r,r��set_timeout_hitr��_threads�clearr�rCrU�get_tmp_dirr
r�rr�r�r�rr�r�r��islinkr�unlink)r�r��pool�_plug�tr6r$r%r�rL�du�fs            r*r.zSoSReport._collect_pluginsj�� ��
"�	&�d�
&��+�+�F�1�I�a�K�8��;���K�K�� 3� 3�V�<�� �-�-�/�4�� ��������(�(��u�=������)��l�l�n�����(�(��S�9����(�(��S�5�[�A�	&�0�9�9�"�"��\�\�-�-�/�F�
8�+�h�v�h�,?�@����8��*�*�,�Q�/�0��(�(����3��Z�Z��'�
!���G�G�L�L���+���7�7�=�=��#�B�G�G�N�N�1�,=��1�I��I�I�a�L�
!���?'�

&���q�	�{�*�5�����!�!�C��u�B�-�0���� � ��%��"�"�)�)�&��)�4��#�#�F�1�I�a�K�0��3�C�C�E��
�
�4�
�(��
�
�#�#�%�

&��	&�	&��@�
8�67��(�(����3�
8�s<�J6�CG3�=K�3B<J3�/J6�2J3�3J6�6K�K"�!K"c	�N�	|\}}|j|dz
d}|jj|�t	|j�}d|�d|��d�d|d�ddjd	�|jD���d
�}|j
|�	|j�	|jj|�	|jj|�d}t	|j�t|jj�kr6|jr*ddd�ddjd�|jD���d
�}|js|jsd}|r|j
|�y#t$rYywxYw#t$r"|jjd|�d��Y��wxYw#t$r#|jjd|�d
��Y��wxYw#t $rYyt"$r�}|j$t&vrg|j(j+d|j,�d��|j(j+d|j.�d��t1j2d�|j5|d�Yd}~yd}~wt$r|j5|d�YywxYw)Nr}Fz  Starting rwz<5rr�z [Running: c3� K�|]}|���y�wrQr�r�s  r*r�z+SoSReport.collect_plugin.<locals>.<genexpr>Ts����,K�1�Q�,K����]zCould not remove z from plugin list, ignoring...z& from running plugin list, ignoring...rz  Finishing plugins z<12c3� K�|]}|���y�wrQr�r�s  r*r�z+SoSReport.collect_plugin.<locals>.<genexpr>ms����%D�A�a�%D�rKz
  Finished running pluginsr8z while collecting plugin dataz# Data collected still available at r�r3)r�r,r!r�r r��ui_progressr;r+r�r�r�r�r�r�r�rrrrr�r�rrLr�r�r{)	r�r��countrwr��numplugs�status_linerr�s	         r*r;zSoSReport.collect_pluginKs���	�$�O�E�8��&�&�u�Q�w�/��2�D����%�%�h�/��t�*�*�+��$��w�a��z�%:�2�$>�a���~�N$�$'�H�H�,K��8J�8J�,K�$K�#L�A�O������%�)	7����!�
��
�
�$�$�V�,�
��"�"�)�)�(�3��F��D�M�M�"�c�$�)�)�*;�*;�&<�<��&�&�0��S�	�� �X�X�%D��1C�1C�%D�D�E�Q�H���%�%�d�m�m�7���� � ��(���a�	��	���
����!�!�'��z�2"�#��
���
����!�!�'��z�2"�#��
���	�
���	7��w�w�/�)����!�!��!�*�*��%B�C�E����!�!�9�$�+�+��b�I�K�������!�!�(�I�6�6����	7��!�!�(�I�6��	7�sy�5E4�G �"F�>F1�BG �4	F�?F�(F.�+G �-F.�.G �1(G�G �G�G � 	J$�+J$�3BJ�J$�#J$c�>�|jjdk(r+|jjsd|jd���}n|�d�}|jjs>t
jj|�t
jj�yy)Nr�
�Zr�)	r�rMr�ljust�quietr^rl�write�flush)r�rQs  r*rNzSoSReport.ui_progress�st���9�9���!�#�D�I�I�O�O��{�0�0��4�5�6�K�(�M��,�K��y�y����J�J���[�)��J�J����r,c	�r�|jsydj|jD�cgc]C}tjj	|��"|tjj	|��f��Ec}D��cgc]\}}|�d|����c}}�dz}|j
j
|d�ycc}wcc}}w)Nr�r��environment)r�r�r��environ�getrUr	)r�r�ry�envs    r*�collect_env_varszSoSReport.collect_env_vars�s����}�}���i�i�;?�=�=�
/�4�
�Z�Z�^�^�D�
!�
-��r�z�z�~�~�d�+�,�
.�
/�
� +��s�t�f�A�c�U�O�
���	��
	
������]�3��
/��
s�AB.�5B3
c���t�}|jD�]g\}}t|��}|jD]}|j	t|���|jr$|j	t|j��|jD]'}|j	t|dd|dz����)|jD]U}|j	t|ddtjjd|j�d|d	��
���W|j D]@\}}}|j	t#|tjjd|�����B|j	|���jt$ddft&d
dft(ddff}	|	D]�\}
}}	|j+�}
|
|�j-�}|j/dd�j1�}|
j3|�|
j5�|j6j9|
tjjd|�����y#t:$r�}|j<t>vrs|j@jCd�|j@jCd|jD�d|�d��|j@jCd�|jGd�Yd}~��Ad}~wwxYw)Nr��srcpathz..�dstpath)r��href�cmdrrIre)r��return_coderbzsos.txt�textzsos.json�JSONzsos.html�HTML�utf-8rr[rrrz while writing z reportr})$rr�r�alerts�addr�custom_textr�copied_filesr�executed_commandsrr�r�r�rO�copy_stringsrrrrrS�unicode�encode�decoderWrXrUr�rrrr�r�rr�)r�rxrwr�r��alertrHrcr��
formatlist�class_�filename�type_�fdrr�s                r*�generate_reportszSoSReport.generate_reports�s������#�1�1�	 �N�H�d��8�,�G����
*�����E�%�L�)�
*�������D��!1�!1�2�3��&�&�
B�����J�A�i�L�,0�1�Y�<�,?�A�B�
B��-�-�
(�����G��U���)+�����(,�(,�(8�(8�(:�8�(D�(+�F��*&�'�(�
(�"�.�.�
E�	��A�r����K�Q�-/�W�W�\�\�$��-B�D�E�
E�
�J�J�w��3	 �:�i�&�1�
�j�&�1�
�j�&�1�
�
�
(2�	"�#�F�H�e�
"��'�'�)�����/�/�1�����w�	�:�A�A�C������ ����
����%�%�b�r�w�w�|�|�M�<D�0F�%�G�	"���
"��7�7�o�-��K�K�%�%�b�)��K�K�%�%��A�J�J�<��u�g�W�E�G��K�K�%�%�b�)��J�J�q�M���

"�s�&B"I�	K$�BK�K$c�<�|jD]�\}}	|jd�r�tj�}|jjd|�|j
�tj�}|jjd|�|jjd||z
�n|jjd|�����y#t$r�}|jtvrp|jjd�|jjd|j�d��|jjd�|jd	�|j!|d�Yd}~��ld}~wt"$r|j!|d�Y���wxYw)
Nr��postproc_start�postproc_end�
postproc_timezSkipping postproc for plugin rrz" while post-processing plugin datar})r��
get_optionrrr�rr�r�r�rrrr�r�rr�r{r�r#s      r*r�zSoSReport.postproc�sF��"�1�1�	<�N�H�d�
<��?�?�:�.�$�L�L�N�E��M�M�+�+�,<�e�D��M�M�O�"�,�,�.�C��M�M�+�+�N�C�@��M�M�+�+�O�S�5�[�I��K�K�$�$�7��z�B�D��	<���
<��7�7�o�-��K�K�%�%�b�)��K�K�%�%��A�J�J�<�'I�J�L��K�K�%�%�b�)��J�J�q�M��%�%�h�
�;�;���
<��%�%�h�
�;�
<�s�B?C�	F�BE9�9F�Fc�F�|sy	d}tj|�}t|d�5}	|j|�}|sn|j	|��&	ddd�|j�S#1swY�xYw#t
$r"|j
�Yj�SwxYw)NFi�rb)�hashlibrR�open�readrr�r{�	hexdigest)r�rU�	hash_name�	hash_size�digest�
archive_fp�hashdatas       r*�_create_checksumzSoSReport._create_checksum�s�����
	$��I��[�[��+�F��g�t�$�
,�
��)���y�9�H�#���M�M�(�+�	��	
,����!�!�
,�
,���	$��!�!�#����!�!�	$�s(�#A5�(A)�A5�)A2�.A5�5B �B c��t|dz|zdd��5}|r|j|dz�ddd�y#1swYyxYw)Nr��wrh)�encodingr�)r�rW)r�rUr��checksum�fps     r*�_write_checksumzSoSReport._write_checksum�sA��
�'�C�-�)�+�S�7�
C�	*�r������D��)�	*�	*�	*�s�5�>c
�h��d}d}d}|j�d}|jjr�	|j|j|j
|j|jd�}td|��}|j|jj��|j�\}}d}|j�|j�/|jj!|jj"�|j%�|r�t&j(j+|j|jj,�}	j/t&j(j+|	dd�d��|j/t&j(j+|	dd	�d	��|j/t&j(j+|	d
d�d��|jj0r|j3�|jj4�radd
lm�ddlm}
|
|j�}t?d�|jAd�D��|jBd<�t?|jBjE���}|jFjId|���tK|jBjM�d�d��dd}
dj+�fd�|
D��}|jFjId|���|jFjId�|jFjId�|jFjId�|jFjId�|jjNs�t'jPd�}|jj0sttd��	|r|jjS�|jjU|jj"�}t'jP|�n�|jjbs|jjdr|jFjgd!�|jj�}t&j(ji|�}|rjk|�}	t&j(j+|j
|�}t'jl||�|}d}|jjN�s2|s
td#��nB	|jjo�}|jq||�}	|js|||�t&j(ji|�}|r!jk|jud&d'��}t&j(j+|j
|�}t'jv|�}|d(z|z}|d(z|z}	t'jl||�|}	t'jl||�|jjy|||||�+�n|jjy||||�+�|jjzs,|jj|s|jj~rt|jjNsA	|jj�|�|jFjItd,��nd.}|jFj�|�t�j��|j�r|j�j�|jr>t&j(j�|j�rt�|j�y#t$r"}ttd|����Yd}~��(d}~wwxYw#tV$r�}td�ttd|jX�d|jj�����td�|jZt\vr|j_d �Yd}~��Cd}~wt$r/|jj`r�Yt'jP|�ywxYw#t'jP|�wxYw#tV$rttd"|����YywxYw#t$rttd$��YywxYw#tV$rttd%|����Y���wxYw#tV$rttd)|����YywxYw#tV$rttd*|����Y��>wxYw#t$r)}|jFj�d-|���Yd}~��yd}~wwxYw)/NF)r{rL�sys_tmpr�r�T)�in_place�hook_commonsz#ERROR: Unable to obfuscate report: rZr~)�
short_namer�r[z
manifest.jsonr)�get_human_readable)�Pathc3�PK�|]}|j�j��� y�wrQ)�lstat�st_size)r�rHs  r*r�z'SoSReport.final_work.<locals>.<genexpr>5s#����?I�*+�A�G�G�I�%�%�?I�s�$&z**/*�sos_logs_reportszNEstimated disk space requirement for whole uncompressed sos report directory: c��|dS)Nr}r�)�xs r*�<lambda>z&SoSReport.final_work.<locals>.<lambda><s
��a��d�r,)�key�reverse�z,  c3�B�K�|]\}}|�d�|d�������y�w)z: r)�	precisionNr�)r�r��vr�s   �r*r�z'SoSReport.final_work.<locals>.<genexpr>=s1����� 8�$(�A�q�$%�#�R�(:�1��(J�'K� L� 8�s�zFive biggest plugins:  rz>Please note the estimation is relevant to the current options.z�Be aware that the real disk space requirements might be different. A rule of thumb is to reserve at least double the estimation.�?zCreating compressed archive...rz while finalizing archive r}zQ
Unable to encrypt when using --build. Encryption is only available for archives.zError moving directory: z Creating archive tarball failed.z:Error generating archive checksum after archive creation.
z!Error writing checksum for file: z.tarz-obfuscated.tarr�zError moving archive file: zError moving checksum file: )rRzUploaded archive successfullyzUpload attempt failed: zEUnable to upload archive when using --build as no archive is created.)G�generate_manifest_tag_summaryr�r;r{rLr�r�r�set_target_pathrU�get_archive_path�executer�r�r�r��add_final_manifest_data�compression_type�_obfuscate_upload_passwordsr�r�r��_name�obfuscate_filerV�add_ui_log_to_stdoutrC�
sos.utilitiesr��pathlibr��sumr�r�r�r�r��sortedr#r8�umask�rename_archive_root�finalizerrrrr�r��encrypt_pass�encrypt_keyr��basename�obfuscate_string�rename�get_preferred_hash_namer�r�r�stat�display_resultsrfrgrn�upload_archiver�r�r�r�r�r)r�rU�	directoryrR�do_cleanr��cleaner�_pathsr�_dirr��tmpdir_path�_sum�
bigplugins�bp_out�	old_umaskr��dir_name�	final_dirr�r��base_archive�
final_name�archivestat�archive_hash�
final_hashr�r�s                           @r*�
final_workzSoSReport.final_work�s�������	����*�*�,����9�9�?�?�
F�"�k�k�"�k�k�#�|�|�#�y�y� $�
�
� ��%�d��N���'�'����(E�(E�(G�H�#*�?�?�#4� ��&���	
�����=�=�$��L�L�0�0����1K�1K�L��(�(�*���7�7�<�<����T�\�\�-?�-?�@�D��"�"�2�7�7�<�<��j�)�#L�.7�
#�
9��"�"�2�7�7�<�<��j�(�#K�.6�
#�
8��"�"������T�=�/�B�*�
#�
��9�9�?�?��%�%�'��9�9�"�"�8�$��t�{�{�+�K�;>�?I�/:�/?�/?��/G�?I�<I�D�$�$�%7�8�&�c�$�*B�*B�*I�*I�*K�&L�M�D��K�K���C�CG�&�J�
K��� 8� 8� >� >� @�$2�D�B�BD�1�F�J��Z�Z� 8�,6� 8�8�F��K�K���6�v�h�?�@��K�K���R� ��K�K���0�
1��K�K���G�
H�
�K�K���R� ��y�y��������I��9�9�?�?��a�8�9�:�
$���L�L�4�4�W�=��,�,�/�/��I�I�.�.�0������#��y�y�%�%����)>�)>����#�#�%0�1����5�5�7�I��w�w�'�'�	�2�H��"�3�3�H�=��
��G�G�L�L����x�@�	��	�	�)�Y�/�%�	�
���y�y�����8�9�!� $��� C� C� E�I�#�4�4�W�i�H�H�
L��(�(��)�X�F� "�w�w�/�/��8���#*�#;�#;�(�0�0��9J�K�$�L� �W�W�\�\�$�,�,��E�
� �g�g�g�.��&��}�y�8��'�#�-�	�9�
�!��I�I�g�z�2�(�G�"L��I�I�l�J�7����+�+�G�Y��,7�(�,�L�
�K�K�'�'���H�19�
(�
;�
�I�I����	�	� 4� 4��9�9�/�/��9�9�?�?�G��K�K�.�.�w�7��K�K�$�$�Q�'F�%G�H�-�����!�!�#�&�	����������$�$�&��;�;�2�7�7�=�=����5��4�;�;����k�
F��a�=�c�U�C�D�E�E��
F��@�
"��b�	��a�!�A�J�J�<�'A��<�<�8�8�:�;�=�>�?��b�	��7�7�o�-��J�J�q�M����
��9�9�?�?�������#�
��
����#���
��a�2�9�+�>�?�@��
�� !�!��!�2�3�4� �!���L��!�?��y�I�J�K�L��*�!��!�9�'��C�D�E� �!��$�L��!�:�<�.�I�J�K�L��!�G��K�K�%�%�(?��u�&E�F�F��G�s��B^8�A_&�Ac�<,c(�)d�d2�'e�?e?�8	_#�_�_#�&	b%�/A5a*�$b(�*#b%�
b(�$b%�%b(�(b?� c%�$c%�(d�d� d/�.d/�2 e�e� e<�;e<�?	f1�f,�,f1c�f�|js%|jjtd��yy)Nzno valid plugins were enabledFT)r�r�r�r�r�s r*�verify_pluginszSoSReport.verify_plugins�s)���"�"��K�K���a� ?�@�A��r,c��|jjd|j�|jjd|jr|jjnd�|jjd|jj�d}td�rMtdtj����}|dd	k(r%|d
j�d	jd�}|jjd�|jjjd
|�|jjjdtj d	��|jjd�|j"j%�D]+\}}|jj"j||��-|jjd|jj&�|jjd|jj(�|jjd�y)zgAdd 'global' data to the manifest, that is any information that is
        not plugin-specific
        r�r^�unsetrar@�ionicez
ionice -p rrrr�priority�io_class�nicenessr��enabled_plugins�disabled_pluginsr�N)r�rr�r^r��add_listr�rar
r
r��getpidrrCr�r��nicer�r#rErV)r��	_io_class�_ior�r�s     r*�add_manifest_datazSoSReport.add_manifest_data�s���	
��� � ��D�L�L�9���� � ��t�{�{�4�;�;�+;�+;�!(�	*������
�D�I�I�,>�,>�?��	���"�(�:�b�i�i�k�]�)C�D�C��8�}��!���M�/�/�1�!�4�:�:�3�?�	����"�"�:�.������)�)�*�i�@������)�)�*�b�g�g�a�j�A����"�"�9�-��,�,�,�,�.�	9�J�C���N�N�"�"�,�,�S�%�8�	9������ 1�4�9�9�3K�3K�L������ 2�D�I�I�4J�4J�K����"�"�9�-r,c	�\��d�fd�	}i�|jjD]N}|jD]
}||��|jD]}||d��
|jD]
}||���P|jjdt
t�j����y)acAdd a section to the manifest that contains a dict summarizing the
        tags that were created and assigned during this report's creation.

        This summary dict can be used for easier inspection of tagged items by
        inspection/analyzer projects such as Red Hat Insights. The format of
        this dict is `{tag_name: [file_list]}`.
        c����|dD]]}||r|s�	�|}|jt||t�r||n||g�t	tt|����|<�_y#t$rg}Y�]wxYw)N�tags)r�r�r�r
r�r�)�entr��tagr��tag_summarys    �r*�compile_tagsz=SoSReport.generate_manifest_tag_summary.<locals>.compile_tags�s�����6�{�

;���3�x�s���&�s�+�D���� *�3�s�8�T� :�C��H��S��
��$*�$�s�4�y�/�#:��C� �

;��
 ���D��s�A(�(A6�5A6�files_copiedr�N)�filepath)	r�r��commands�files�collectionsr�dictr�r#)r�r�r�rc�_file�
collectionr�s      @r*r�z'SoSReport.generate_manifest_tag_summary�s����	;����N�N�*�*�	)�D��}�}�
"���S�!�
"����
4���U�N�3�
4�"�.�.�
)�
��Z�(�
)�	)�	
��� � ��!%�f�[�->�->�-@�&A�!B�	Dr,c	��|jjdt�ddj|j��d��|j
jj�}dt�d|j
j�ddj|��d�}|jj|�|jjdt�ddj|jj�����y)	N�[z:setup] executing 'sos rr�z:setup] using 'z' preset defaults (r|z:setup] effective options now: )	r�r��__name__r�rzr^r�r�r�)r��preset_argsr�s   r*�_merge_preset_optionszSoSReport._merge_preset_options	s��������1�X�J�'!�!$���$�,�,�!7� 8��;�	<��k�k�&�&�.�.�0���8�*�O�D�K�K�,<�,<�+=�>��H�H�[�)�*�!�-���������	
�����1�X�J�&E��H�H�T�Y�Y�%6�%6�%8�9�:�<�	=r,c�J�	|jj|j��|j�|j	�|j�|j
�|j�|j�|jjr|j�t�|jjr|j�t�|jjr|j�t�|jjr+|j|jj�t�|jjr+|j|jj�t�|j!�st�|j#�|j%�|j'�|j)�|j+�|jj,s|j/�|jj0s|j3�|jj4s|j7�n|j8j;d�|j=�|j?�S#t@$rC|jjBr�tEjFdd�dk(s|jI�Yn�tJ$r?|j8jMd�|jI�|jOd�Yn]t$rR}tEjFdd�dk(s|jI�tQjR|jT�Yd}~nd}~wwxYw|jOd�y)Nz)Skipping postprocessing of collected data�
SOS_TEST_LOGS�keepz
Exiting on user cancelrr}F)+r{�set_commonsrOr�r�r�r�r�r�r�rL�
SystemExitrNrMrtrur�rrr�rr3rYr^rXrxrZr�r�r�r)r�rr�r��getenv�cleanuprr�r�r^�exit�coders  r*r�zSoSReport.executes}��8	��K�K�#�#�D�$4�$4�$6�7������!�!�#��&�&�(���� ��+�+�-��$�$�&��y�y�%�%��!�!�#� � ��y�y�&�&��"�"�$� � ��y�y�%�%��!�!�#� � ��y�y�#�#�����	�	� 4� 4�5� � ��y�y�#�#�����	�	� 4� 4�5� � ��&�&�(� � ��J�J�L��L�L�N��"�"�$��J�J�L��L�L�N��9�9�(�(��%�%�'��9�9�&�&��%�%�'��9�9�(�(��
�
����� � �!L�M��L�L�N��?�?�$�$���	��y�y�����9�9�_�d�3�v�=������ �	��K�K���8�9��L�L�N��J�J�s�O��	��9�9�_�d�3�v�=������H�H�Q�V�V����	��
	
�
�
�1�
�s'�J"J%�%A	N�0AN�6N�>AN�NrQ)NN)r@)rr)Jr��
__module__�__qualname__�__doc__r>�
root_requiredr�arg_defaultsr�classmethodr�r�r�r�r�r�r�r�r�r�rrrrr�rOrSrWr�r��staticmethodr]r{r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�rLrNrMrtrurrvrrr)r3r.r;rNr^rxr�r�r�r�r�r�r�r�r��
__classcell__)r�s@r*r5r5KsL����<�D��M�>��e�>��E�>�	��>�	�2�	>�
	�&�>�	��
>�	�V�>�	�U�>�	��>�	�2�>�	�2�>�	�r�>�	�5�>�	��>�	��>� 	�"�!>�"	��#>�$	�B�%>�&	��'>�(	�B�)>�*	��+>�,	��->�.	��/>�0	��1>�2	�B�3>�4	��5>�6	�6�7>�8	��9>�:	�b�;>�<	��=>�>	�d�?>�@	�U�A>�B	�u�C>�D	�u�E>�F	�U�G>�H	��I>�J	��K>�L	�&�M>�N	�/�O>�P	��Q>�R	�B�S>�T	��U>�V	�%�W>�X	��Y>�Z	�R�[>�\	�%�]>�^	�d�_>�`	�D�a>�b	�t�c>�d	�t�e>�f	��g>�h!&�!�"� � � $� $�#'���{>�L�@%%�N�KH��KH�Z�4��4�lA�	
��>�,�.
�
�>	��(0
�d�,� 
�

�(�2�
$�
'�����
7�
K�K�5�;�
;�
;���M�^)�9&�v
�=�
�6�G,�R,�,!�0�:�(!� A��29�>4��0/�b5�n�4�5"�n<�0"�"*�M�^�.�2D�@
=�=r,r5)Fr�)3r^rjr�rr�r�rmrr��concurrent.futuresrrr=�shutilr�sos.report.pluginsr�r�rrr	r
rrr
rr�r�
sos.componentr�sos.policies�sos.report.reportingrrrrrrrrrr�sos.cleanerr�ENOSPC�EROFSrr+r0r�r5r�r,r*�<module>rs�����	����
���1�B���*�*�*���&��:�:�:�#��<�<����-���$>�+��J��Jr,
¿Qué es la limpieza dental de perros? - Clínica veterinaria


Es la eliminación del sarro y la placa adherida a la superficie de los dientes mediante un equipo de ultrasonidos que garantiza la integridad de las piezas dentales a la vez que elimina en profundidad cualquier resto de suciedad.

A continuación se procede al pulido de los dientes mediante una fresa especial que elimina la placa bacteriana y devuelve a los dientes el aspecto sano que deben tener.

Una vez terminado todo el proceso, se mantiene al perro en observación hasta que se despierta de la anestesia, bajo la atenta supervisión de un veterinario.

¿Cada cuánto tiempo tengo que hacerle una limpieza dental a mi perro?

A partir de cierta edad, los perros pueden necesitar una limpieza dental anual o bianual. Depende de cada caso. En líneas generales, puede decirse que los perros de razas pequeñas suelen acumular más sarro y suelen necesitar una atención mayor en cuanto a higiene dental.


Riesgos de una mala higiene


Los riesgos más evidentes de una mala higiene dental en los perros son los siguientes:

  • Cuando la acumulación de sarro no se trata, se puede producir una inflamación y retracción de las encías que puede descalzar el diente y provocar caídas.
  • Mal aliento (halitosis).
  • Sarro perros
  • Puede ir a más
  • Las bacterias de la placa pueden trasladarse a través del torrente circulatorio a órganos vitales como el corazón ocasionando problemas de endocarditis en las válvulas. Las bacterias pueden incluso acantonarse en huesos (La osteomielitis es la infección ósea, tanto cortical como medular) provocando mucho dolor y una artritis séptica).

¿Cómo se forma el sarro?

El sarro es la calcificación de la placa dental. Los restos de alimentos, junto con las bacterias presentes en la boca, van a formar la placa bacteriana o placa dental. Si la placa no se retira, al mezclarse con la saliva y los minerales presentes en ella, reaccionará formando una costra. La placa se calcifica y se forma el sarro.

El sarro, cuando se forma, es de color blanquecino pero a medida que pasa el tiempo se va poniendo amarillo y luego marrón.

Síntomas de una pobre higiene dental
La señal más obvia de una mala salud dental canina es el mal aliento.

Sin embargo, a veces no es tan fácil de detectar
Y hay perros que no se dejan abrir la boca por su dueño. Por ejemplo…

Recientemente nos trajeron a la clínica a un perro que parpadeaba de un ojo y decía su dueño que le picaba un lado de la cara. Tenía molestias y dificultad para comer, lo que había llevado a sus dueños a comprarle comida blanda (que suele ser un poco más cara y llevar más contenido en grasa) durante medio año. Después de una exploración oftalmológica, nos dimos cuenta de que el ojo tenía una úlcera en la córnea probablemente de rascarse . Además, el canto lateral del ojo estaba inflamado. Tenía lo que en humanos llamamos flemón pero como era un perro de pelo largo, no se le notaba a simple vista. Al abrirle la boca nos llamó la atención el ver una muela llena de sarro. Le realizamos una radiografía y encontramos una fístula que llegaba hasta la parte inferior del ojo.

Le tuvimos que extraer la muela. Tras esto, el ojo se curó completamente con unos colirios y una lentilla protectora de úlcera. Afortunadamente, la úlcera no profundizó y no perforó el ojo. Ahora el perro come perfectamente a pesar de haber perdido una muela.

¿Cómo mantener la higiene dental de tu perro?
Hay varias maneras de prevenir problemas derivados de la salud dental de tu perro.

Limpiezas de dientes en casa
Es recomendable limpiar los dientes de tu perro semanal o diariamente si se puede. Existe una gran variedad de productos que se pueden utilizar:

Pastas de dientes.
Cepillos de dientes o dedales para el dedo índice, que hacen más fácil la limpieza.
Colutorios para echar en agua de bebida o directamente sobre el diente en líquido o en spray.

En la Clínica Tus Veterinarios enseñamos a nuestros clientes a tomar el hábito de limpiar los dientes de sus perros desde que son cachorros. Esto responde a nuestro compromiso con la prevención de enfermedades caninas.

Hoy en día tenemos muchos clientes que limpian los dientes todos los días a su mascota, y como resultado, se ahorran el dinero de hacer limpiezas dentales profesionales y consiguen una mejor salud de su perro.


Limpiezas dentales profesionales de perros y gatos

Recomendamos hacer una limpieza dental especializada anualmente. La realizamos con un aparato de ultrasonidos que utiliza agua para quitar el sarro. Después, procedemos a pulir los dientes con un cepillo de alta velocidad y una pasta especial. Hacemos esto para proteger el esmalte.

La frecuencia de limpiezas dentales necesaria varía mucho entre razas. En general, las razas grandes tienen buena calidad de esmalte, por lo que no necesitan hacerlo tan a menudo e incluso pueden pasarse la vida sin requerir una limpieza. Sin embargo, razas pequeñas como el Yorkshire o el Maltés, deben hacérselas todos los años desde cachorros si se quiere conservar sus piezas dentales.

Otro factor fundamental es la calidad del pienso. Algunas marcas han diseñado croquetas que limpian la superficie del diente y de la muela al masticarse.

Ultrasonido para perros

¿Se necesita anestesia para las limpiezas dentales de perros y gatos?

La limpieza dental en perros no es una técnica que pueda practicarse sin anestesia general , aunque hay veces que los propietarios no quieren anestesiar y si tiene poco sarro y el perro es muy bueno se puede intentar…… , pero no se va a poder pulir ni acceder a todas la zona de la boca …. Además los limpiadores dentales van a irrigar agua y hay riesgo de aspiración a vías respiratorias si no se realiza una anestesia correcta con intubación traqueal . En resumen , sin anestesia no se va hacer una correcta limpieza dental.

Tampoco sirve la sedación ya que necesitamos que el animal esté totalmente quieto, y el veterinario tenga un acceso completo a todas sus piezas dentales y encías.

Alimentos para la limpieza dental

Hay que tener cierto cuidado a la hora de comprar determinados alimentos porque no todos son saludables. Algunos tienen demasiado contenido graso, que en exceso puede causar problemas cardiovasculares y obesidad.

Los mejores alimentos para los dientes son aquellos que están elaborados por empresas farmacéuticas y llevan componentes químicos con tratamientos específicos para el diente del perro. Esto implica no solo limpieza a través de la acción mecánica de morder sino también un tratamiento antibacteriano para prevenir el sarro.

Conclusión

Si eres como la mayoría de dueños, por falta de tiempo , es probable que no estés prestando la suficiente atención a la limpieza dental de tu perro. Por eso te animamos a que comiences a limpiar los dientes de tu perro y consideres atender a su higiene bucal con frecuencia.

Estas simples medidas pueden conllevar a que tu perro tenga una vida más larga y mucho más saludable.

Si te resulta imposible introducir un cepillo de dientes a tu perro en la boca, pásate con él por clínica Tus Veterinarios y te explicamos cómo hacerlo.

Necesitas hacer una limpieza dental profesional a tu mascota?
Llámanos al 622575274 o contacta con nosotros

Deja un comentario

Tu dirección de correo electrónico no será publicada. Los campos obligatorios están marcados con *

¡Hola!