Current File : //usr/lib/python3/dist-packages/sos/__pycache__/archive.cpython-312.pyc
�

-�_gr����ddlZddlZddlZddlZddlZddlZddlZddlZddlmZddl	m
Z
ddlmZddl
mZ	ddlZdZdZdZd	ZGd
�d�ZGd�d
e�ZGd�de�Zy#e$rY�0wxYw)�N)�datetime)�Lock)�	find_spec)�sos_get_command_output�file�link�node�dirc���eZdZdZed��Zejd�ZdZ	dZ
e�Zd�Z
d�Zd�Zd	�Zd
�Zd�Zd�Zdd�Zdd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zy
)�Archivez!Abstract base class for archives.c��|jS)z6Returns the archive class's name as a string.
        )�__name__)�clss �-/usr/lib/python3/dist-packages/sos/archive.py�archive_typezArchive.archive_type+s���|�|���sos�unsetFc�.�d|j��d|��S)Nz	[archive:z] )r��self�msgs  r�_format_msgzArchive._format_msg8s���4�,�,�.�/�r�#��7�7rc��||_y�N)�_debug)r�debugs  r�	set_debugzArchive.set_debug;s	����rc�X�|jj|j|��yr)�log�errorrrs  r�	log_errorzArchive.log_error>s�������t�'�'��,�-rc�X�|jj|j|��yr)r �warningrrs  r�log_warnzArchive.log_warnAs��������)�)�#�.�/rc�X�|jj|j|��yr)r �inforrs  r�log_infozArchive.log_infoDs�����
�
�d�&�&�s�+�,rc�r�|jsy|jj|j|��yr)rr rrrs  r�	log_debugzArchive.log_debugGs'���{�{�������t�'�'��,�-rc��|jSr)�_name�rs r�namezArchive.nameLs���z�z�rNc��t�r��NotImplementedError)r�src�dest�forces    r�add_filezArchive.add_fileR���!�!rc��t�rr0)r�contentr3�modes    r�
add_stringzArchive.add_stringUr6rc��t�rr0)rr8r3s   r�
add_binaryzArchive.add_binaryXr6rc��t�rr0)r�source�	link_names   r�add_linkzArchive.add_link[r6rc��t�rr0�r�paths  r�add_dirzArchive.add_dir^r6rc��t�rr0)rrCr9�devices    r�add_nodezArchive.add_nodear6rc��t�)z�Return a temporary directory that clients of the archive may
        use to write content to. The content of the path is guaranteed
        to be included in the generated archive.r0r-s r�get_tmp_dirzArchive.get_tmp_dird�
��"�!rc��t�)z�Return the maximum file name length this archive can support.
        This is the lesser of the name length limit of the archive
        format and any temporary file system based cache.r0r-s r�name_maxzArchive.name_maxjrJrc��t�)aTReturn a string representing the path to the temporary
        archive. For archive classes that implement in-line handling
        this will be the archive file itself. Archives that use a
        directory based cache prior to packaging should return the
        path to the temporary directory where the report content is
        locatedr0r-s r�get_archive_pathzArchive.get_archive_pathps
��"�!rc��t�)z:Clean up any temporary resources used by an Archive class.r0r-s r�cleanupzArchive.cleanupys��!�!rc��t�)aFinalize an archive object via method. This may involve creating
        An archive that is subsequently compressed or simply closing an
        archive that supports in-line handling. If method is automatic then
        the following methods are tried in order: xz, gzipr0�r�methods  r�finalizezArchive.finalize}s
��
"�!r�NF��w)r�
__module__�__qualname__�__doc__�classmethodr�logging�	getLoggerr r,rr�
_path_lockrrr"r%r(r*r.r5r:r<r@rDrGrIrLrNrPrT�rrrr(s���+�����
�'�
�
�E�
"�C��E�
�F���J�8��.�0�-�.�
�"�"�"�"�"�"�"�"�"�"�"rrc��eZdZdZdZdZdZ	dd�Zd�Zd�Z	dd�Z
dd�Zd	�Zdd
�Z
dd�Zd�Zd
�Zd�Zd�Zd�Zd�Zd�Zdd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zy) �FileCacheArchivezd Abstract superclass for archive types that use a temporary cache
    directory in the file system. �Nc��||_tjj|j|g�|k(r%tjj	||�|_||_||_||_||_|xsd|_	||_
tjj||�|_|j5tj|jd�ddd�|jd|j�d��y#1swY�)xYw)N�/�z'initialised empty FileCacheArchive at '�')r,�osrC�commonprefix�relpath�_tmp_dir�_policy�_threads�enc_opts�sysroot�manifest�join�
_archive_rootr^�makedirsr()rr.�tmpdir�policy�threadsrmrnros        r�__init__zFileCacheArchive.__init__�s�����
�
�7�7������V� 4�5��?�������v�6�D�J���
������
� ��
��~�#��� ��
��W�W�\�\�&�$�7���
�_�_�	3��K�K��*�*�E�2�	3��
�
���,�,�-�Q�0�	1�	3�	3�s�:!D�Dc���tjj|�r|jtj�}tjj|j|�Sr)rgrC�isabs�lstrip�seprprq)rr.s  r�	dest_pathzFileCacheArchive.dest_path�s?��
�7�7�=�=����;�;�r�v�v�&�D��w�w�|�|�D�.�.��5�5rc���|jr|j|j�r|S|dtjk(r|dd}tjj|j|�S)Nr�)rn�
startswithrgrzrCrprBs  r�join_sysrootzFileCacheArchive.join_sysroot�sQ���|�|�t���t�|�|�<��K���7�b�f�f�����8�D��w�w�|�|�D�L�L�$�/�/rc���|jd|���|j�|}�fd�}|jd�s|}nRtjj|j
|��r|n!tjj|�d}|}g}|dvr:tjj|�\}}	|j|	�|}|dvr�:|j��}
d}|D�]�}tjj|
|�}
||
�s�-tjj||�}tjj|
�r�m|jd|
���tjj|��rtjj|�r�tj|�}
tjj|�d}tjj||
�}|j||��}tjj|�}tjj!|
�r tjj#|
|�}
|jd|
�d	|
�d
��tj$|
|
����|jd|
���tj&|
|�|}���|S)a�Create leading path components

            The standard python `os.makedirs` is insufficient for our
            needs: it will only create directories, and ignores the fact
            that some path components may be symbolic links.

            :param src: The source path in the host file system for which
                        leading components should be created, or the path
                        to an sos_* virtual directory inside the archive.

                        Host paths must be absolute (initial '/'), and
                        sos_* directory paths must be a path relative to
                        the root of the archive.

            :param mode: An optional mode to be used when creating path
                         components.
            :returns: A rewritten destination path in the case that one
                      or more symbolic links in intermediate components
                      of the path have altered the path destination.
        zMaking leading paths for c�b��|jtjj�d��S)z>Test whether path ``path`` is inside the archive.
            rb)r~rgrCrp)rC�roots �r�
in_archivez8FileCacheArchive._make_leading_paths.<locals>.in_archive�s#����?�?�2�7�7�<�<��b�#9�:�:rrdr)rdrbzMaking path �r9zMaking symlink '�' -> 'rfzMaking directory )r*rqr~rgrC�isdirr�split�append�reverserp�exists�islink�readlink�_make_leading_paths�normpathrxri�symlink�mkdir)rr2r9r3r��src_dirrC�
path_comps�head�tail�abs_path�src_path�comp�target�
target_dir�
target_srcr�s                @rr�z$FileCacheArchive._make_leading_paths�sR���,	
���2�3�%�8�9��!�!����	;�
�~�~�c�"��G�!�g�g�m�m�D�,=�,=�c�,B�C�s��G�G�M�M�#�.�q�1�
����
��)�#������t�,�J�D�$����d�#��D��)�#�	���������%	$�D��w�w�|�|�H�d�3�H��h�'���w�w�|�|�H�d�3�H��7�7�>�>�(�+�����h�Z�8�9��7�7�>�>�(�+����
�
�h�0G��[�[��2�F�"$�����x�!8��!;�J�"$�����j�&�!A�J� �3�3�J�T�3�J�D��7�7�+�+�D�1�D��w�w�}�}�V�,�!#�������!D���N�N�%5�h�Z�@'�'-�h�a�$1�2��J�J�v�x�0��N�N�%6�x�j�#A�B��H�H�X�t�,�#�D�K%	$�N�rc�
�|xs|j|�}|tk(r|}n"tjj	|�d}|s|Stjj|�r.tjj
|�std|�d���tjj|�s>|tk(r|n!tjj	|�d}|j|�d�}|r|Stjj|�r�tj|�}d}	|tk(r/tj|j�st|	|dfz��|tk(r/tj|j�st|	|dfz��|t k(r"||j�st|	|dfz��|tk(r/tj"|j�st|	|d	fz��y
|S)a4Check a new destination path in the archive.

            Since it is possible for multiple plugins to collect the same
            paths, and since plugins can now run concurrently, it is possible
            for two threads to race in archive methods: historically the
            archive class only needed to test for the actual presence of a
            path, since it was impossible for another `Archive` client to
            enter the class while another method invocation was being
            dispatched.

            Deal with this by implementing a locking scheme for operations
            that modify the path structure of the archive, and by testing
            explicitly for conflicts with any existing content at the
            specified destination path.

            It is not an error to attempt to create a path that already
            exists in the archive so long as the type of the object to be
            added matches the type of object already found at the path.

            It is an error to attempt to re-create an existing path with
            a different path type (for example, creating a symbolic link
            at a path already occupied by a regular file).

            :param src: the source path to be copied to the archive
            :param path_type: the type of object to be copied
            :param dest: an optional destination path
            :param force: force file creation even if the path exists
            :returns: An absolute destination path if the path should be
                      copied now or `None` otherwise
        rzpath 'z' exists and is not a directoryc��ttj|�tj|�tj|�tj
|�g�Sr)�any�stat�S_ISBLK�S_ISCHR�S_ISFIFO�S_ISSOCKr�s r�
is_specialz/FileCacheArchive.check_path.<locals>.is_special7sD������T�"����T�"��
�
�d�#��
�
�d�#�	��
rz path '%s' exists and is not a %szregular filez
symbolic linkzspecial file�	directoryN)r{�P_DIRrgrCr�r�r��
ValueErrorr��lstat�P_FILEr��S_ISREG�st_mode�P_LINK�S_ISLNK�P_NODE�S_ISDIR)
rr2�	path_typer3r4�dest_dirr�r��st�ve_msgs
          r�
check_pathzFileCacheArchive.check_paths���>�*�t�~�~�c�*������H��w�w�}�}�T�*�1�-�H���K��7�7�>�>�(�#�B�G�G�M�M�(�,C��v�h�Z�0)�)�*�
*��w�w�~�~�h�'�&�%�/�c�R�W�W�]�]�3�5G��5J�G��$�$�W�-�	���K��7�7�>�>�$�����$��B�7�F��F�"�4�<�<��
�
�+C� ��4��*@�!@�A�A��F�"�4�<�<��
�
�+C� ��4��*A�!A�B�B��F�"�:�b�j�j�+A� ��4��*@�!@�A�A��E�!�$�,�,�r�z�z�*B� ��4��*=�!=�>�>���rc���	tj|�}|jd�s|jd�rDtj||�tj
||j|jf��ntj||�tj||j|j�y#t$r"}|jd|�d|�d��Yd}~yd}~wwxYw)N�/sys/�/proc/)�nszcaught 'z' setting attributes of 'rf)rgr�r~�shutil�copymode�utime�st_atime_ns�st_mtime_ns�copystat�chown�st_uid�st_gid�	Exceptionr*)rr2r3�_stat�es     r�_copy_attributesz!FileCacheArchive._copy_attributesSs���		K��G�G�C�L�E��~�~�g�&�#�.�.��*B�����T�*�����5�#4�#4�e�6G�6G�"H�I�����T�*��H�H�T�5�<�<����6���	K��N�N�X�a�S�(A�$��q�I�J�J��	K�s�B<B?�?	C*�C%�%C*c	��|j5|s|}|j|t|��}|s
	ddd�yt|dd�s0	t	j
||�|j||�d|�d�}nC|jd�t|d	d
��5}|D]}|j|��	ddd�d}|jd
|�d|j�d��ddd�y#t$rE}|jd�s|jd�rn|jd|�d|�d��Yd}~��d}~wwxYw#1swY��xYw#1swYyxYw)N�r4�readr�r�zFile z not collected: 'rfrrW�utf-8��encodingz	open filezadded z to FileCacheArchive ')r^r�r��getattrr��copy�OSErrorr~r(r��seek�open�writer*rq)rr2r3r4r��	file_name�f�lines        rr5zFileCacheArchive.add_file`sW��
�_�_�!	6�����?�?�4��u�?�=�D���
!	6�!	6��3���-�J��K�K��T�*��%�%�c�4�0���u�A�J�	�������$��g�6�&�!� #�&������
�&�&�(�	��N�N�V�I�;�/�#�1�1�2�!�5�
6�A!	6�!	6���J��~�~�g�.�#�.�.��2J���
�
��c�U�2C�A�3�a�&H�I���J��&�&��7!	6�!	6�sR� D>�
D>�C!�8D>�D2�,,D>�!	D/�*;D*�%D>�*D/�/D>�2D;	�7D>�>Ec	���|j5|}|j|td��}tj||d��5}t|t�r|jdd�}|j|�tjj|�r|j||�|jd|�d|j�d	��ddd�ddd�y#1swY�xYw#1swYyxYw)
NTr�r�r��utf8�ignorezadded string at 'z' to FileCacheArchive 'rf)r^r�r��codecsr��
isinstance�bytes�decoder�rgrCr�r�r*rq)rr8r3r9r2r�s      rr:zFileCacheArchive.add_string�s���
�_�_�	:��C��?�?�4��t�?�<�D����T�4�'�:�
:�a��g�u�-�%�n�n�V�X�>�G����� ��7�7�>�>�#�&��)�)�#�t�4����!2�3�%�8#�#'�#5�#5�"6�a� 9�:�

:�	:�	:�
:�
:��	:�	:�s$�3C$�BC�C$�C!	�C$�$C-c�J�|j5|j|t�}|s
	ddd�ytj|dd��5}|j|�ddd�|j
d|�d|j�d��ddd�y#1swY�4xYw#1swYyxYw)N�wbr�zadded binary content at 'z' to archive 'rf)r^r�r�r�r�r�r*rq)rr8r3r�s    rr<zFileCacheArchive.add_binary�s���
�_�_�	6��?�?�4��0�D���	6�	6�
���T�4�$�7�
!�1����� �
!��N�N�6�t�f�=�#�1�1�2�!�5�
6�	6�	6�

!�
!��	6�	6�s(�B�B�B
�*B�
B	�B�B"c
���|jd|�d|�d��|j5|j|t�}|s
	ddd�ytj
j
|�s;t	j||�|jd|�d|�d|j�d��ddd�|jd|�d|�d	���tj
j|�}tj
jtj
j||��}|j|�}d
�}tj
j|��s�tj
j|�r�|}tj
j|�}tj
j|t	j|��}tj
j!||�}|||�r|jd|�d|�d
��y|jd|�d|�d��|j#||�ytj
j%|�r'|jd|�d��|j'|�ytj
j)|�r'|jd|�d��|j+|�y|jd|�d|���yy#1swY��9xYw)Nzadding symlink at 'r�rfzadded symlink at 'z' to 'z' in archive 'zLink follow up: source=z link_name=z dest=c��tjj|�}tjj|�s=tjj	tjj||��}tjj	|�}||k(ry	tj|�y#t$r}|jdk(rYd}~y�d}~wwxYw)z�Return ``True`` if the symbolic link ``link_name`` is part
                of a file system loop, or ``False`` otherwise.
            T�(NF)	rgrC�dirnamerx�realpathrpr�r��errno)r?r>�link_dirr�s    r�is_loopz*FileCacheArchive.add_link.<locals>.is_loop�s����w�w���y�1�H��7�7�=�=��(����)�)�"�'�'�,�,�x��*H�I�����(�(��3�I��F�"��
����	�"�
��	�
��7�7�b�=����
�s�"B8�8	C�C�C�CzLink 'z' - 'z' loops: skipping...zAdding link z -> z for link follow upzAdding dir zAdding file zNo link follow up: source=)r*r^r�r�rgrC�lexistsr�rqr�r�rpr{r�r�r�rir@r�rD�isfiler5)	rr>r?r3�
source_dir�host_path_name�dest_path_namer�r�s	         rr@zFileCacheArchive.add_link�s}�����,�Y�K�v�f�X�Q�G�H�
�_�_�	B��?�?�9�f�5�D���	B�	B�
�7�7�?�?�4�(��
�
�6�4�(����!3�D�6���x�H+�+/�+=�+=�*>�a� A�B�	B�	
���0����I�;���v�'�	(��W�W�_�_�Y�/�
����)�)�"�'�'�,�,�z�6�*J�K������7��	�.�w�w�~�~�n�-��w�w�~�~�n�-�*�	��7�7�?�?�9�5�������h����N�0K�L���������:���9�f�-��N�N�V�I�;�e�F�8�D1�$1�2������i�[��V�H�E+� +�,��
�
�f�i�0������~�.�����V�H�4G�H�I����^�,�������/�����f�X�5H�I�J��
�
�n�-����!;�F�8�D,�,5�;� 8�9�/.�W	B�	B�s�K�AK�K#c�r�|j5|j|t�ddd�y#1swYyxYw)zmCreate a directory in the archive.

            :param path: the path in the host file system to add
        N)r^r�r�rBs  rrDzFileCacheArchive.add_dir�s.���_�_�	)��O�O�D�%�(�	)�	)�	)�s�-�6c�h�|j|t�}|sytjj	|�s+	tj
|||�|j||�yy#t$rC}|jtjk(rd}|jd|�d|�d��Yd}~y|�d}~wwxYw)NzOperation not permittedz
add_node: z
 - mknod 'rf)r�r�rgrCr��mknodr�r��EPERMr(r�)rrCr9rFr3r�rs       rrGzFileCacheArchive.add_node�s������t�V�,�����w�w�~�~�d�#�
�����t�V�,�
�!�!�$��-�$���
��7�7�e�k�k�)�3�C��M�M�J�s�e�:�d�V�1�"E�F�����
�s�A%�%	B1�.7B,�*B,�,B1c��dtjvr3tjd}tj|j|�Sy)N�PC_NAME_MAX�)rg�pathconf_names�pathconfrq)r�pc_name_maxs  rrLzFileCacheArchive.name_maxs:���B�-�-�-��+�+�M�:�K��;�;�t�1�1�;�?�?�rc��|jSr�rqr-s rrIzFileCacheArchive.get_tmp_dir	����!�!�!rc��|jSrr�r-s rrNz!FileCacheArchive.get_archive_pathr�rc���tjtjj|j|�|��|jd|�d|j�d��y)zsCreate path, including leading components.

            Used by sos.sosreport to set up sos_* directories.
        r�zcreated directory at 'z' in FileCacheArchive 'rfN)rgrrrCrprqr*)rrCr9s   rrrzFileCacheArchive.makedirssR��
	���B�G�G�L�L��!3�!3�T�:��F����/��v�6��-�-�.�a�1�	2rc�V�|j|�}tj|ddd��S)N�rr�r�)r��errors)r{r�r�rBs  r�	open_filezFileCacheArchive.open_files%���~�~�d�#���{�{�4��w�x�H�Hrc��tjj|j�r t	j
|j�yyr)rgrCr�rqr��rmtreer-s rrPzFileCacheArchive.cleanups/��
�7�7�=�=��+�+�,��M�M�$�,�,�-�-rc��tj�}|jj}||z
}|jj	d|�|jj	d|�|jj	d|�|j|jj
d��tjjdd��y)	z�Adds component-agnostic data to the manifest so that individual
        SoSComponents do not need to redundantly add these manually
        �end_time�run_time�compression�)�indent�sos_reportsz
manifest.jsonN)
r�nowro�
start_time�	add_fieldr:�get_jsonrgrCrp)rrS�end�startrs     r�add_final_manifest_dataz(FileCacheArchive.add_final_manifest_data s����l�l�n���
�
�(�(����;���
�
���
�C�0��
�
���
�H�5��
�
���
�v�6�����
�
�.�.�a�.�8������]�O�D�	Frc�t�|j|j�|_tjj	|j
|j�}tj|j|�||_tjj	|j
|j��|_	y)zeRename the archive to an obfuscated version using an initialized
        SoSCleaner instance
        N)
�obfuscate_stringr,rgrCrprj�renamerqr.�
_archive_name)r�cleaner�	_new_roots   r�rename_archive_rootz$FileCacheArchive.rename_archive_root-ss���-�-�d�j�j�9��
��G�G�L�L�����
�
�;�	�
�	�	�$�$�$�i�0�&����W�W�\�\�$�-�-�����E��rc��tjtjz}t|d�r|j}|j
|z}n|}|}d}|j
|�5}|j�}ddd�t|t�s|jdd�}tj||||��\}	}
|
r|j|	|�|
Sd}
|
S#1swY�axYw)a�Apply a regexp substitution to a file in the archive.

        :param path: Path in the archive where the file can be found
        :type path: ``str``

        :param regexp:  A regex to match the contents of the file
        :type regexp: ``str`` or compiled ``re`` object

        :param subst: The substitution string to be used to replace matches
                      within the file
        :type subst: ``str``

        :returns: Number of replacements made
        :rtype: ``int``
        �patternrbNr�r�)�flagsr)
�re�
IGNORECASE�	MULTILINE�hasattrrrr�r�r��strr��subnr:)rrC�regexp�subst�common_flagsrrr8�readable�result�replacementss           r�do_file_subzFileCacheArchive.do_file_sub7s��� �}�}�r�|�|�3���6�9�%��n�n�G��L�L�<�/�E��G� �E���
�^�^�D�
!�	&�X��m�m�o�G�	&��'�3�'��n�n�V�X�6�G�!�w�w�w��w�-2� 4������O�O�F�D�)����L���	&�	&�s�!C�Cc�6�|jd|j�d|�d��	|j|�}|j
�|jd|j�dtj|j�j�d��|jdr	|j|�S|S#t$r.}|j	d|���|j�cYd}~Sd}~wwxYw#t$r$}d	}|j	|�d
|���|cYd}~Sd}~wwxYw)Nzfinalizing archive 'z' using method 'rfz+An error occurred compressing the archive: zbuilt archive at 'z' (size=�)�encryptz)An error occurred encrypting the archive:� )
r(rq�_build_archiver�r"r.rPrrgr��st_sizerm�_encrypt)rrS�res�errr��exp_msgs      rrTzFileCacheArchive.finalize\s���
�
�,�T�-?�-?�,@�A�!�(�!�%�	&�	��%�%�f�-�C�
	
�����
�
�*�4�+=�+=�*>�?�!�w�w�t�'9�'9�:�B�B�C�1�F�	G��=�=��#�
��}�}�S�)�)��J��!�	��N�N�H���N�O��9�9�;���	���
�E�����'��!�A�3�/�0��
��
�s;�B1�C+�1	C(�:#C#�C(�#C(�+	D�4D�
D�Dc���|jdd�}|dz
}d|�d�}d}|jdr|d|jd�d�z
}||z
}|jd	r3|jd	jd
d�}d|i}|d
z
}d|�d�}||z
}t|d|��}|ddk(r|S|ddk(r)|jdr
d}t|��d}t|��d|d��}t|��)a�Encrypts the compressed archive using GPG.

        If encryption fails for any reason, it should be logged by sos but not
        cause execution to stop. The assumption is that the unencrypted archive
        would still be of use to the user, and/or that the end user has another
        means of securing the archive.

        Returns the name of the encrypted archive, or raises an exception to
        signal that encryption failed and the unencrypted archive name should
        be used.
        z
sosreport-zsecured-sosreport-z.gpgzgpg --batch -o r'N�keyz--trust-model always -e -r �passwordz'"rb�sos_gpgz-c --passphrase-fd 0 z/bin/bash -c "echo $sos_gpg | �"r)�timeout�env�status�zSpecified key not in keyringzCould not read passphrasezgpg exited with code )�replacermrr�)r�archive�arc_name�enc_cmdr4�passwdr�rs        rr*zFileCacheArchive._encryptss5���?�?�<�1E�F���F���#�H�:�Q�/�����=�=���
�4�T�]�]�5�5I�4J�!�L�L�G��w��G��=�=��$��]�]�:�.�6�6�u�b�A�F��f�%�C��.�.�G�7��y��C�G��w��G�"�7�A�3�?���X�;�!���O��X�;�!���}�}�U�#�4����n��2��
��n��*�!�H�+��7�C���n�rc�"�|j�Sr)r.rRs  rr(zFileCacheArchive._build_archive�s���y�y�{�rr)rerUrV)rrXrYrZrjrqrrvr{rr�r�r�r5r:r<r@rDrGrLrIrNrrr�rPrrr#rTr*r(r_rrrara�s���&��H��M��M��1�$6�
0�[�zI�VK�"6�H:�&	6�E9�N)�.� �"�"�2�I�.�F�F�#�J�.)�Vrrac�N��eZdZdZdZdZ	d
�fd�	Zd
d�Zd�Zd�Z	d�Z
d	�Z�xZS)�TarFileArchivez: archive class using python TarFile to create tar archivesNFc	���t�|�|||||||�d|_tjj||j
��|_y)N�tar)�superrv�_suffixrgrCrpr.r)	rr.rsrtrurmrnro�	__class__s	        �rrvzTarFileArchive.__init__�sF���
����v�v�w�!�7�H�	6�����W�W�\�\��D�I�I�K�
��rc��|j|_|jd�|jd<|jd�|jd<|r||_n|j|_|j|_|j|_
y)Nz.9f�atime�ctime)�st_mtime�mtime�st_atime�pax_headers�st_ctimer9r�r��uidr��gid)r�tar_info�fstatr9s    r�set_tarinfo_from_statz$TarFileArchive.set_tarinfo_from_stat�sj�������+0�>�>�#�*>����W�%�+0�>�>�#�*>����W�%�� �H�M�!�M�M�H�M��|�|����|�|��rc���|jttjj	|j
�d�d��s|j
�gd�}t
�fd�|D��ry	tj��}|jr"|j��}|r||jd<|j||�|S#t$r|cYSwxYw)N���)z
/version.txt$z/sos_logs(/.*)?z/sos_reports(/.*)?c3�J�K�|]}tj|�����y�wr)r�match)�.0�skip�	orig_paths  �r�	<genexpr>z9TarFileArchive.copy_permissions_filter.<locals>.<genexpr>�s�����;�T�r�x�x��i�(�;�s� #zRHT.security.selinux)
r.�lenrgrCr�rqr�r�r��_with_selinux_context�get_selinux_contextrJrP)r�tarinfo�skipsrO�contextrWs     @r�copy_permissions_filterz&TarFileArchive.copy_permissions_filter�s�����L�L��R�W�W�]�]�4�3E�3E�%F�r�%J�!K�!L�M�	���*�*�I�J���;�U�;�;��	��G�G�I�&�E��%�%��.�.�y�9�G��>E��#�#�$:�;��"�"�7�E�2�����	��N�	�s�,C�C�Cc�V�	tj|�\}}|S#t$rYywxYwr)�selinux�
getfileconr�)rrC�_�cs    rr[z"TarFileArchive.get_selinux_context�s2��	��'�'��-�F�Q���H���	��	�s��	(�(c�8�|j�d|j��S)N�.)rqrBr-s rr.zTarFileArchive.name�s���$�$�%�Q�t�|�|�n�5�5rc���|dk(rtd��dnd}|jd�}|j�d|��|_|dk(rddi}nd	d
i}tj|jfdd|��i|��5}d
D]�}t
jjt
jj|j|��s�K|jt
jj|j|�|j�d|������|j|j|j|j��ddd�|xjd|��z
c_
|j�S#1swY�1xYw)N�auto�lzma�xz�gzip�iprf�
compresslevel��preset�r9zw:)zversion.txtr�sos_logsrd)�arcname)rr�filter)r�stripr�tarfiler�rgrCr�rprq�addr,r_rBr.)rrS�
_comp_mode�kwargsr@�_contents      rr(zTarFileArchive._build_archive�sa���V��&�v�.�:�T��F��\�\�$�'�
� $� 2� 2�3�1�Z�L�A����V��%�q�)�F���]�F�
�\�\�$�,�,�$�R�
�|�3D�$�"�$�	9�'*�G�
���7�7�>�>�"�'�'�,�,�t�/A�/A�8�"L�M��G�G������T�%7�%7��B�#'�:�:�,�a��z� :���
�
�G�G�D�&�&��
�
��7�7�
�
9�	9�	
���!�J�<�(�(���y�y�{��!	9�	9�s�/A
E+�=A>E+�+E4r)
rrXrYrZrSrZrvrPr_r[r.r(�
__classcell__)rCs@rr>r>�s4���D�
�F�!���
�	$��$�6�rr>)rgrur�r\r�r�r�rr�	threadingr�importlib.utilr�
sos.utilitiesrra�ImportErrorr�r�r�r�rrar>r_rr�<module>rs���
��
��
���	���$�0�	��
��	��	��
��Z"�Z"�zZ�w�Z�zS�%�S��M�	�	�		�s�A'�'A/�.A/
¿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!