Current File : //proc/self/root/usr/lib/python3/dist-packages/uaclient/__pycache__/apt.cpython-312.pyc
�

l�gF�����ddlZddlZddlZddlZddlZddlZddlZddlZddlZddl	m
Z
mZddlm
Z
mZmZmZmZmZmZddlZddlmZddlmZmZmZmZmZmZmZddlm Z ddl!m"Z"dZ#d	Z$d
Z%dZ&dZ'd
Z(dZ)dZ*dZ+dZ,dZ-dZ.dZ/dZ0dZ1dZ2dZ3dZ4dZ5ejljoe d�ejljoe d�gejljoe d�ejljoe d�ejljoe d�ejljoe d �gd!�Z8gd"�Z9ejt�Z;ejxejze>��Z?ej�Gd#�d$ej���ZBed%d&eCfd'eCfd(eCfg�ZDd)�ZEeEd*eCd+eCfd,��ZFd-�ZGd.eCd/eeCfd0�ZH		dud1eeCd2eeCd3ee
eCeCfd/eCfd4�ZIe
d�5�		dud2eeCd3ee
eCeCfd/eCfd6��ZJGd7�d8�ZKd9�ZLd:�ZMd;eCd/eeCfd<�ZN	dvd;eCd=eOd/eeCfd>�ZP	dwd3ee
eCeCfd/eCfd?�ZQej�ej�ej�fe9�d@eCfdA��ZU		dudBeeCdCeeeCd3ee
eCeCfd/eCfdD�ZVdEeCd/eej�fdF�ZXdEeeCd/eej�fdG�ZY	dwdHej�dIeeCd/eej�fdJ�Z[dKeeCdLeCdMeOdNeCd/eCf
dO�Z\	dvdKeeCdLeCdMeOdNeCdPeCdQeOd/eCfdR�Z]dSeCdNeCdTeCdKeeCdPeCdUeeCd/dfdV�Z^dW�Z_dX�Z`	dwdSeCdNeCdUeeCdPeeCd/df
dY�ZadZ�Zbd[�Zcd\�Zdd]�Zed^eCd/eOfd_�Zfd/eeDfd`�Zgd/eeCfda�ZhddeBj�fdbeeCdceeCddeeBd/dfde�Zjd/eekfdf�Zld/eekfdg�Zmd/eejfdh�Zndi�Zodxdj�ZpdkeeCdleCfdm�ZqdkeeCdleCfdn�ZrdkeeCfdo�Zsdp�Ztdq�ZudreeCd/e
eCeeCeeCfffds�Zvd/eCfdt�Zwy)y�N)�	lru_cache�wraps)�Dict�Iterable�List�
NamedTuple�Optional�Set�Union)�AcquireProgress)�event_logger�
exceptions�gpg�messages�secret_manager�system�util)�ESM_APT_ROOTDIR)�status_cache_filegN@z  # ubuntu-pro-clientzDir::Etc::netrc/zDir::Etc::netrcparts/zDir::State::lists/a�/*
 * Autogenerated by ubuntu-pro-client
 * Do not edit this file directly
 *
 * To change what ubuntu-pro-client sets, use the `pro config set`
 * or the `pro config unset` commands to set/unset either:
 *      global_apt_http_proxy and global_apt_https_proxy
 * for a global apt proxy
 * or
 *      ua_apt_http_proxy and ua_apt_https_proxy
 * for an apt proxy that only applies to Ubuntu Pro related repos.
 */
z$Acquire::http::Proxy "{proxy_url}";
z%Acquire::https::Proxy "{proxy_url}";
z4Acquire::http::Proxy::esm.ubuntu.com "{proxy_url}";
z5Acquire::https::Proxy::esm.ubuntu.com "{proxy_url}";
z/etc/apt/trusted.gpg.d/z/usr/share/keyringsz/usr/lib/apt/methods/httpsz /usr/sbin/update-ca-certificatesz//etc/apt/apt.conf.d/90ubuntu-advantage-aptproxyz*/var/lib/apt/periodic/update-success-stampz/var/lib/dpkg/status)�xenial�bionic�focal�jammyz�# Written by ubuntu-pro-client
Types: deb{deb_src}
URIs: {url}
Suites: {suites}
Components: main
Signed-By: {keyrings_dir}/{keyring_file}
zetc/apt/sources.listzvar/lib/dpkg/statuszetc/apt/apt.conf.dzetc/apt/preferences.dzvar/cache/apt/archives/partialzvar/lib/apt/lists/partial)�files�folders)g�?g@g$@c�(�eZdZe�Ze�Zy)�
AptProxyScopeN)�__name__�
__module__�__qualname__�object�GLOBAL�UACLIENT���./usr/lib/python3/dist-packages/uaclient/apt.pyrrcs��
�X�F��x�Hr%r�InstalledAptPackage�name�version�archc�.��t���fd��}|S)z*Decorator ensuring apt_pkg is initialized.c���tjjd�dk(rtj��|i|��S)N�Dir�)�apt_pkg�config�get�init)�args�kwargs�fs  �r&�new_fz"ensure_apt_pkg_init.<locals>.new_fqs5����>�>���e�$��*��L�L�N��$�!�&�!�!r%)r)r5r6s` r&�ensure_apt_pkg_initr7ns"����1�X�"��"��Lr%�a�bc�.�tj||�S�N)r/�version_compare)r8r9s  r&r<r<|s���"�"�1�a�(�(r%c��|jd�\}}tjjd�sy	t	j
�5}t
jdddj||||�tjj|d�gtt��ddd�y#1swYyxYw#tj$r�}tjdt!|��|j"d	k(r{t!|j$�j'�}t)j*d
|�rtj,|���t)j*d|�rtj.|���tj0t!|��
��d}~wt2j4$rtj6t|���wxYw)aValidate apt credentials for a PPA.

    @param repo_url: private-ppa url path
    @param username: PPA login username.
    @param password: PPA login password or resource token.

    @raises: UbuntuProError for invalid credentials, timeout or unexpected
        errors.
    �://z/usr/lib/apt/apt-helperNz
download-filez{}://{}:{}@{}/pool/zapt-helper-output)�timeout�retry_sleepszError running apt-helper: %s�dz401\s+unauthorized|httperror401)�repozconnection timed out��detail)�secondsrB)�split�os�path�exists�tempfile�TemporaryDirectoryr�subp�format�join�APT_HELPER_TIMEOUT�APT_RETRIESr�ProcessExecutionError�LOG�error�str�	exit_code�stderr�lower�re�search�APTInvalidCredentials�
APTTimeout�APTUnexpectedError�
subprocess�TimeoutExpired�APTCommandTimeout)�repo_url�username�password�protocol�	repo_path�tmpd�erVs        r&�assert_valid_apt_credentialsrg�se��#�.�.��/��H�i�
�7�7�>�>�3�4��
�
�
(�
(�
*�	�d��K�K�-�#�)�0�0� �(�H�i���G�G�L�L��':�;�
�+�(�
�	�	�	���+�+�;��	�	�0�#�a�&�9��;�;�#������]�(�(�*�F��y�y�;�V�D� �6�6�H�E�E����2�F�;� �+�+��:�:��+�+�3�q�6�:�:���$�$�
��*�*�&�Y�
�	
�
�s7�B4�
AB(�B4�(B1�-B4�1B4�4G�CF�2G�	apt_error�returnc��t�}|j�jd�D]W}|s�tjd|�}|s�d|j�djd�dz}|j
|��Y|S)aAParse apt update errors for invalid apt config in user machine.

    This functions parses apt update errors regarding the presence of
    invalid apt config in the system, for example, a ppa that cannot be
    reached, for example.

    In that scenario, apt will output a message in the following formats:

    The repository 'ppa 404 Release' ...
    Failed to fetch ppa 404 ...

    On some releases, both of these errors will be present in the apt error
    message.

    :param apt_error: The apt error string
    :return: a NamedMessage containing the error message
    �
z2(Failed to fetch |The repository .)(?P<url>[^\s]+)z- �urlz/distsr)�set�striprFrXrY�	groupdict�add)rh�failed_repos�line�
pattern_match�repo_url_matchs     r&�(_parse_apt_update_for_invalid_apt_configru�s���(�5�L����!�'�'��-�1����I�I�E�t��M���=�2�2�4�U�;�A�A�(�K�A�N�N��� � ��0�1��r%�cmd�	error_msg�override_env_varsc��	tj|dt|��\}}|S#tj$r�}t
j
dt|�t|��dt|j�vrtj��	t|j�}|r.tjdjt|�����|r|n
t|�}tj|���d}~wwxYw)	a�Run an apt command, retrying upon failure APT_RETRIES times.

    :param cmd: List containing the apt command to run, passed to subp.
    :param error_msg: The string to raise as UbuntuProError when all retries
       are exhausted in failure.
    :param override_env_vars: Passed directly as subp's override_env_vars arg

    :return: stdout from successful run of the apt command.
    :raise UbuntuProError: on issues running apt-cache policy.
    T)�capturer@rxz Error running apt command %s: %sz%Could not get lock /var/lib/dpkg/lockrk)rqrCN)rrLrPrrQrRrSrTrV�APTProcessConflictErrorru�APTInvalidRepoErrorrN�sortedr\)rvrwrx�out�_errrfrq�msgs        r&�run_apt_commandr��s���8��K�K���$�/�	
�	��T�0�J��%�+�+�8��	�	�4�c�#�h��A��G�2�c�!�(�(�m�C��4�4�6�6�
�
D�A�H�H�M�L�� �4�4�!%���6�,�+?�!@���%�i�#�a�&���+�+�3�7�7��#8�s� $�C;�B?C6�6C;)�maxsizec�"�tddg||��S)N�	apt-cache�policy)rvrwrx)r�)rwrxs  r&�get_apt_cache_policyr��s��
�
�(�#��+��r%c��eZdZd�Zd�Zd�Zy)�PreserveAptCfgc� �||_i|_yr;)�apt_func�current_apt_cfg)�selfr�s  r&�__init__zPreserveAptCfg.__init__	s�� ��
�!��r%c	���tj}|j�D�cic]'}|tj|j|����)c}|_|j�Scc}wr;)r/r0�keys�copy�deepcopyr1r�r�)r��cfg�keys   r&�	__enter__zPreserveAptCfg.__enter__
sR���n�n��8;���
� 
�14�C����s�w�w�s�|�,�,� 
����}�}����	 
s�,A'c���tj}|jj�D]!}|j	||j|��#tj
�yr;)r/r0r�r�rm�init_system)r��type�value�	tracebackr�r�s      r&�__exit__zPreserveAptCfg.__exit__sP���n�n���'�'�,�,�.�	4�C��G�G�C��-�-�c�2�3�	4����r%N)rrr r�r�r�r$r%r&r�r�s��"��r%r�c���tjj�D]!}tjj|��#tj�tj
d�Sr;)r/r0r��clearr2�Cache�r�s r&�get_apt_pkg_cacher�sH���~�~�"�"�$�"�������S�!�"��L�L�N��=�=���r%c��	t�tjj�D]8}t	j
d|�r�tjj
|��:tjjdt�tj�tjd�S#t$ricYSwxYw)Nz^Acquirer-)�_ensure_esm_cache_structurer/r0r�rXrYr�rmrr2r��	Exceptionr�s r&�get_esm_apt_pkg_cacher�&s����	$�%��>�>�&�&�(�	*�C��9�9�Z��-����$�$�S�)�	*�	�����5�/�2������}�}�T�"�"�����	��s�AB2�A-B2�2C�?C�pkg_namec���tt�5}	||}	ddd�jr|jjSy#t$rYddd�ywxYw#1swY�CxYwr;)r�r��KeyError�current_ver�ver_str)r��cache�packages   r&�get_pkg_versionr�>sn��	�)�	*��e�	��H�o�G������"�"�*�*�*���
�	��	��	����s(�A�A�	A�A�A�A�A#�check_esm_cachec�`�tt�5}	||}tj|�}|j|�}|s
	ddd�y|j}ddd�|sStt�5}|ri	||}tj|�}	|	j|�}
|
scddd�S|
j}tj|�dk\r|cddd�Sddd�S#t$rYddd�ywxYw#1swY��xYw#t$rcYcddd�SwxYw#1swYSxYw)Nr)	r�r�r�r/�DepCache�get_candidate_verr�r�r<)r�r�r�r��	dep_cache�	candidate�candidate_version�	esm_cache�esm_package�
esm_dep_cache�
esm_candidate�esm_candidate_versions            r&�get_pkg_candidate_versionr�Ksh��
�)�	*�.�e�	��H�o�G��$�$�U�+�	��/�/��8�	���.�.�&�-�-��.�� � �	�-�	.�-�)��
)�'��1��$�,�,�Y�7�M�)�;�;�K�H�M� �(�-�-�%2�$9�$9�!��'�'�)�+<����
-�)-�-�-�,���G�	��	.�.�	��.�.��(�
)�(�(�-�-�
)��	-�,��si�C=�C&�)C=�	C=�0D#�4D	�9)D#�,&D#�&	C:�/C=�9C:�:C=�=D�	D �D#�D � D#�#D-c��	tddg|��}	tj�|S#tj$r8}tj	dt|��tj��d}~wtj$r%}tj|j���d}~wtj$r%}tj|j���d}~wwxYw#tj�wxYw)N�apt-get�update�rvrxz Error running apt-get update: %s��repo_msgrC)r�rr{rRrSrT�APTUpdateProcessConflictErrorr|�APTUpdateInvalidRepoErrorr��UbuntuProError�APTUpdateFailedr��cache_clear)rxr~rfs   r&�run_apt_update_commandr�ws���+���H�%�9J�
��	�(�(�*��J���-�-�9��	�	�4�c�!�f�=��6�6�8�8���)�)�C��2�2�A�E�E�B�B���$�$�7��(�(����6�6��7��	�(�(�*�s8�(�C�3A.�.C� B$�$C�: C�C�C"�"C8�sources_list_pathc���tt�5}tjj	dt
jj|��tjj	dd�tjj	dd�tj�}|j�t�}t
jjtjjd�d�}tj|�}	|5|j||d�ddd�t.j1�	ddd�y#1swY�'xYw#ttd	d
�$r8}t j#dt%|��t'j(��d}~wt*$r$}t'j,t%|����d}~wwxYw#t.j1�wxYw#1swYyxYw)
NzDir::Etc::sourcelistzDir::Etc::sourcepartszN.O.F.O.L.D.E.RzAPT::List-Cleanup�0zDir::State::Lists�lockr�Errorr$zError updating apt cache: %srC)r�r�r/r0rmrGrH�abspath�
SourceList�read_main_listrrN�find_dir�FileLockr��getattrrRrSrTrr{�SystemErrorr�r�r�)r�r��sources_list�fetch_progress�	lock_filer�rfs       r&�update_sources_listr��s���

�)�	*�"/�e������"�B�G�G�O�O�4E�$F�	
�	�����2�4E�F������.��4��)�)�+���#�#�%�)�*���G�G�L�L��N�N�#�#�$7�8�&�
�	����	�*��
	/��
>����^�\�1�=�
>�
!�,�,�.�E"/�"/�2
>�
>���w���,�	7��I�I�4�c�!�f�=��4�4�6�6���	<��,�,�C��F�;�;��	<��
!�,�,�.��E"/�"/�s`�C>G*�E�E�%E�-G*�E	�E�G�+3F�G�*G	�	G�G�G'�'G*�*G3�packages�apt_optionsc�(�|�g}	tgd�|z|z|��}|S#tj$r+tj	d|�tj
��tj$r%}tj|j���d}~wwxYw)N)r��install�--assume-yesr�z)Error running apt install for packages %sr�)	r�rr{rRrS�APTInstallProcessConflictErrorr|�APTInstallInvalidRepoErrorr�)r�r�rxr~rfs     r&�run_apt_install_commandr��s���
����D��6�����0�	
���J��
�-�-�:��	�	�=�x�H��7�7�9�9��)�)�D��3�3�Q�U�U�C�C��D�s��AB�, B�B�originc�4�t�}tt�5}|jD]F}|j}|s�|j
D]&\}}|j|k(s�|j|��(�H	ddd�t|�S#1swYt|�SxYwr;)	rmr�r�r�r��	file_listr�rp�list)r��resultr�r��installed_version�file�_s       r&� get_installed_packages_by_originr��s����U�F�	�)�	*�,�e��~�~�	,�G� '� 3� 3�� �0�:�:�,�G�D�!��{�{�f�,��
�
�7�+�,�	,�,���<��,���<��s�B�!B�B�Bc��|�gSt�}tt�5}tj|�}|j
D]`}|j}|s�|j|�}|s�&||k7s�,|jD]&\}}|j|k(s�|j|��(�b	ddd�t|�S#1swYt|�SxYwr;)rmr�r�r/r�r�r�r�r�r�rpr�)	r�r�r�r�r�r�r�r�r�s	         r&�;get_installed_packages_with_uninstalled_candidate_in_originr��s����~��	��U�F�	�)�	*�	0�e��$�$�U�+�	��~�~�	0�G� '� 3� 3�� �%�7�7��@�	���.?�!?�#,�#6�#6�0���a��;�;�&�0�"�J�J�w�/�0�	0�	0���<��	0���<��s#�3B7�B7�&B7�,!B7�B7�7C
r��exclude_originc���g}|jD]R}|jD��cgc]%\}}|jdk7r|j|k7r|��'}}}|s�B|j	|��T|Scc}}w)N�now)�version_listr��	componentr��append)r�r��valid_versionsr)r�r��
valid_originss       r&�get_remote_versions_for_packager��s����N��'�'�
+��#�,�,�
���a��~�~��&�4�;�;�.�+H�
�
�
�
���!�!�'�*�
+����
s�*A&�suites�series�updates_enabledr`c��d}|D]?}||vr�d}d|vr|stjd||�d}|dj|||��z
}�A|S)Nr.�-updatesz?Not enabling apt suite "%s" because "%s-updates" is not enabledz# zC{maybe_comment}deb {url} {suite} main
# deb-src {url} {suite} main
)�
maybe_commentrl�suite)rR�warningrM)r�r�r�r`�contentr�r�s       r&�_get_list_file_contentr�	s|���G��
�������
������K�K����	
�!�M��
-�-3�V�+���.4�.�	
��
�&�Nr%�keyring_file�include_deb_srcc��|D�cgc]	}||vs�|��}}|s*tjd|�|D�cgc]	}d|vs�|��}}|rdnd}tj|dj	|�t
||��}	|	Scc}wcc}w)NzPNot enabling service-related -updates suites because "%s-updates" is not enabledr�z deb-srcr.� )rlr��keyrings_dirr��deb_src)rRr��DEB822_REPO_FILE_CONTENTrMrN�KEYRINGS_DIR)
r�r�r�r`r�r�r��appliable_suitesrr�s
          r&�_get_sources_file_contentr#s���,2�E�%�V�u�_��E��E�����
+��	
� 0�
��:�U�3J�E�
��
�,�j��G�&�-�-���x�x�(�)�!�!��.��G��N��+F��
s�	A6�A6�	A;�A;�
repo_filename�credentials�
snapshot_urlsc��	|jd�\}}tjj	|�tj�j}|jd�r|dd}t|||�d}	tddgtj�}
|
j�D]}d	j|�|vr�d
|vr�d}	n|g|zD]}t|||��|t vrmt"j$j't(|�}
t"j$j't*|�}t-j.|
|�t1|||	|�}nt3|||	||�}tj4||�y#t$rd}|}Y��rwxYw)z�Add an authenticated apt repo and credentials to the system.

    @raises: InvalidAPTCredentialsError when the token provided can't access
        the repo PPA.
    �:�bearer�/N���Fr�r�za={}-updatesz	o=Ubuntu,T)rF�
ValueErrorr�secrets�
add_secretr�get_release_infor��endswithrgr�r�APT_POLICY_FAILED�
splitlinesrM�add_apt_auth_conf_entry�SERIES_NOT_USING_DEB822rGrHrNr�APT_KEYS_DIRr�export_gpg_keyr�r�
write_file)rr`rr�r�rrarbr�r�r�rrrl�source_keyring_file�destination_keyring_filer�s                r&�add_auth_apt_reporCs����(�.�.�s�3���(����%�%�h�/�
�
$�
$�
&�
-�
-�F�������C�R�=�� ��8�X�>��O�
�	�h���!;�!;��F��!�!�#���� � ��(��4���d�"����
���z�M�)�9����X�x�8�9��(�(� �g�g�l�l�<��F��#%�7�7�<�<��l�#K� ����.�0H�I�(��F�O�X�
��,��F�O�X�|�
�����m�W�-��Q�������s�E8�8
F	�F	c��t�}d|vr|jd�\}}n|}|jd�s|dz
}tjj|�rt
j|�}nd}dj|||t��}d}g}	|j�D]h}
|sS|
j�}t|�dk\r5|d}||k(r|	j|�d	}�A||vr|	j|�d	}|	j|
��j|s|	j|�|	jd�t
j|d
j|	�d��y
)zBAdd or replace an apt auth line in apt's auth.conf file or conf.d.r>rr.z:machine {repo_path} login {login} password {password}{cmt})rd�loginrb�cmtF��Trk���modeN)�!get_apt_auth_file_from_apt_configrFrrGrHrIr�	load_filerM�APT_AUTH_COMMENTr�lenr�rrN)
r`rrb�
apt_auth_file�	_protocolrd�orig_content�repo_auth_line�added_new_auth�	new_linesrr�
split_line�curr_line_repos
             r&rr}sX��5�7�M����'�~�~�e�4��	�9��	����c�"��S��	�	�w�w�~�~�m�$��'�'�
�6����	������ �	�
���N��I��'�'�)��������J��:��!�#�!+�A���!�Y�.��$�$�^�4�%)�N��!�Y�.��$�$�^�4�%)�N������� �����(�
���R��
���m�T�Y�Y�y�%9��Fr%c���d|vr|jd�\}}n|}|jd�r|dd}t�}tjj|�r�t
j|�}dj|��}dj|j�D�cgc]	}||vs�|��c}�}|st
j|�yt
j||d�	�yycc}w)
z+Remove a repo from the shared apt auth filer>rNrzmachine {repo_path}/ login)rdrkr!r")
rFrr$rGrHrIrr%rMrNr�ensure_file_absentr)r`r)rdr(�apt_auth�auth_prefixrrr�s        r&�remove_repo_from_apt_auth_filer4�s������'�~�~�e�4��	�9��	����#���c�r�N�	�5�7�M�	�w�w�~�~�m�$��#�#�M�2��2�9�9�I�9�N���)�)�&�1�1�3�O�d�{�$�7N�T�O�
����%�%�m�4����m�W�5�A�%��
Ps�	C&�)C&c�D�tj|�|jd�r)tjtj|d��|r9t
jjt|�}tj|�|g|zD]
}t|��y)z>Remove an authenticated apt repo and credentials to the systemz.sourcesr�N)
rr1rr�set_filename_extensionrGrHrNrr4)rr`rr�rls     r&�remove_auth_apt_repor7�s������m�,����j�)��!�!��'�'�
�v�>�	
���w�w�|�|�L�,�?���!�!�,�/��z�M�)�,��&�s�+�,r%c��|jd�\}}|jd�r|dd}dj||��}tj||�y)z.Add an apt preferences file and pin for a PPA.r>rNrz<Package: *
Pin: release o={origin}
Pin-Priority: {priority}
)r��priority)rFrrMrr)�apt_preference_filer`r�r9r)rdr�s       r&�add_ppa_pinningr;�sY��#�>�>�%�0��I�y����#���c�r�N�	�	%�%+�V�6�H�V�%M��
���)�7�3r%c��tjdddtg�\}}|r|jd�ddzStjdddtg�\}}|jd�djd�S)z7Return to patch to the system configured APT auth file.�
apt-config�shellr��'r z90ubuntu-advantager)rrL�APT_CONFIG_AUTH_PARTS_DIRrF�APT_CONFIG_AUTH_FILE�rstrip)r~rs  r&r$r$�s~�����	�w��'@�A��I�C����y�y��~�a� �#7�7�7��K�K�
�7�E�+?�@�
�	��T��y�y��~�a� �'�'��,�,r%c��|jd�\}}|jd�r|dd}d}tjdddtg�\}}|r|jd	�d
}|jdd�}t
tjtjj||dj|�z���S)
zEList any apt files in APT_CONFIG_LISTS_DIR given repo_url and series.r>rNrz/var/lib/apt/listsr=r>r�r?r r�z
_dists_{}*)rFrrrL�APT_CONFIG_LISTS_DIR�replacer}�globrGrHrNrM)r`r�r)rd�	lists_dirr~r�aptlist_filenames        r&�find_apt_list_filesrI�s���#�>�>�%�0��I�y����#���c�r�N�	�$�I����	�w��';�<��I�C����I�I�c�N�1�%�	� �(�(��c�2����	�	��G�G�L�L��+�l�.A�.A�&�.I�I�
�	
��r%c�P�t||�D]}tj|��y)z?Remove any apt list files present for this repo_url and series.N)rIrr1)r`r�rHs   r&�remove_apt_list_filesrKs&��#�H�f�5�(���!�!�$�'�(r%�pkgc��|t�vSr;)�get_installed_packages_names)rLs r&�is_installedrO
s���.�0�0�0r%c	��g}tt�5}|jD]L}|j}|s�|j	t|j|j|j����N	ddd�|S#1swY|SxYw)N)r(r)r*)	r�r�r�r�r�r'r(r�r*)�	installedr�r�r�s    r&�get_installed_packagesrRs����I�	�)�	*�
�e��~�~�		�G� '� 3� 3�� �� � �'�$�\�\� 1� 9� 9�.�3�3���		�
���
���s�A9�=A9�9Bc�V�t�}|D�cgc]}|j��}}|Scc}wr;)rRr()�package_listrL�	pkg_namess   r&rNrN!s,��)�+�L�%1�2�c����2�I�2����3s�&�
http_proxy�https_proxy�proxy_scopec���|s|rb|r`d}|tjk(rd}n|tjk(rd}tj	t
jj|���d}|rY|tjk(r|tj|��z
}n,|tjk(r|tj|��z
}|rY|tjk(r|tj|��z
}n,|tjk(r|tj|��z
}|dk7r	t|z}|dk(rtjt�ytj t|�y)a�
    Writes an apt conf file that configures apt to use the proxies provided as
    args.
    If both args are None, then no apt conf file is written. If this function
    previously wrote a conf file, and was run again with both args as None,
    the existing file is removed.

    :param http_proxy: the url of the http proxy apt should use, or None
    :param https_proxy: the url of the https proxy apt should use, or None
    :return: None
    r.z	UA-scoped�global)�scope)�	proxy_urlN)rr#r"�event�infor�SETTING_SERVICE_PROXY_SCOPErM�APT_CONFIG_UA_PROXY_HTTP�APT_CONFIG_GLOBAL_PROXY_HTTP�APT_CONFIG_UA_PROXY_HTTPS�APT_CONFIG_GLOBAL_PROXY_HTTPS�APT_PROXY_CONFIG_HEADERrr1�APT_PROXY_CONF_FILEr)rVrWrX�message�apt_proxy_configs     r&�setup_apt_proxyrh'sm�� �[���G��m�4�4�4�%���
� 4� 4�4�"���J�J��4�4�;�;�'�;�J�
�����-�0�0�0�� 8� ?� ?�$�!@�!�
���M�0�0�
0�� <� C� C�$�!D�!�
����-�0�0�0�� 9� @� @�%�!A�!�
���M�0�0�
0�� =� D� D�%�!E�!�
���2��2�5E�E���2���!�!�"5�6����-�/?�@r%c��d}tjjt�r#tjt�j
}|Sr;)rGrHrI�APT_UPDATE_SUCCESS_STAMP_PATH�stat�st_mtime��
cache_times r&�get_apt_cache_timero_s3���J�	�w�w�~�~�3�4��W�W�:�;�D�D�
��r%c��d}tjjt�r#tjt�j
}|Sr;)rGrHrI�DPKG_STATUS_PATHrkrl)�status_times r&�get_dpkg_status_timersfs3���K�	�w�w�~�~�&�'��g�g�.�/�8�8���r%c��t�}|�ytjj|tjj�Sr;)ro�datetime�
fromtimestamp�timezone�utcrms r&�get_apt_cache_datetimeryms8��#�%�J�������*�*�:�x�7H�7H�7L�7L�M�Mr%c���tjtjjtd�d���t
dt
dz}t
�fd�|D��rytjt�t
dD]}tj|��t
dD]}tj|dd���y)	Nz**/*T)�	recursiverrc3�&�K�|]}|�v���
y�wr;r$)�.0r��existing_filess  �r&�	<genexpr>z._ensure_esm_cache_structure.<locals>.<genexpr>|s�����=�t�D�N�"�=�s�i�)�exist_okr#)rFrGrHrNr�ESM_BASIC_FILE_STRUCTURE�allr�ensure_folder_absent�create_file�makedirs)�
desired_filesr��folderr~s   @r&r�r�ts�����Y�Y�
�����_�f�-���N�	!��)�,D�Y�,O�O���=�}�=�>������0�)��1�!�����4� �!�*�9�5�7��
���F�T��6�7r%c	�J�tj�syt�ddlm}ddlm}ddlm}m	}d}d}tj�}|�||�d}|jdg�D]W}|jdd�d	k(r|jd
d�dk(}|jdd�d
k(s�C|jd
d�dk(}�Y||�}	|r1|	j�d|jk(r|	j�n|	j!�tj"�rK||�}
|r1|
j�d|jk(r|
j�n|
j!�t%t&�5}t)j*�}|j-�Gd�dt.�}
|
�}	|j1||d�ddd�y#t2$r7}t4j7dj9t;|���Yd}~�Dd}~wwxYw#1swYyxYw)Nr)�status)�ApplicationStatus)�ESMAppsEntitlement�ESMInfraEntitlementF�servicesr(r.zesm-apps�	available�no�yesz	esm-infrac�L�eZdZdejfd�Zdejfd�Zy)�-update_esm_caches.<locals>.EsmAcquireProgress�itemc�`�tjdj|j��y)NzFetched ESM Apt Cache item: {})rR�debugrM�uri�r�r�s  r&�donez2update_esm_caches.<locals>.EsmAcquireProgress.done�s���	�	�:�A�A�$�(�(�K�Lr%c�`�tjdj|j��y)Nz&Failed to fetch ESM Apt Cache item: {})rRr�rMr�r�s  r&�failz2update_esm_caches.<locals>.EsmAcquireProgress.fail�s �����<�C�C�D�H�H�M�r%N)rrr r/�AcquireItemDescr�r�r$r%r&�EsmAcquireProgressr��s(��
M��!8�!8�
M�
��!8�!8�
r%r�z%Failed to fetch the ESM Apt Cache: {})r�is_current_series_ltsr��uaclient.actionsr��(uaclient.entitlements.entitlement_statusr��uaclient.entitlements.esmr�r�r�readr1�application_status�DISABLED�setup_local_esm_repo�disable_local_esm_repo�is_current_series_active_esmr�r�r/r�r�rr�r�rRr�rMrT)r�r�r�r�r��apps_available�infra_available�current_status�service�apps�infrar�r�r�r�rfs                r&�update_esm_cachesr��s����'�'�)���!�'�J��
�N��O�&�+�+�-�N������Q���!�%�%�j�"�5�F���;�;�v�r�"�j�0�$�[�[��d�;�u�D�N��;�;�v�r�"�k�1�%�k�k�+�t�<��E�O�	F��c�"�D�	��#�#�%�a�(�,=�,F�,F�F��!�!�#��#�#�%��*�*�,�#�C�(����(�(�*�1�-�1B�1K�1K�K��&�&�(��(�(�*�
�-�	.�P�%��)�)�+���#�#�%�	��	�,�-��	P��L�L���q�9�P�P�� �	P��K�K�?�F�F�s�1�v�N�O�O��	P��!P�P�s0�>;H�:G�	H�-H�H�H�H�H"�
package_names�
error_messagec�@�tgd�t|�z|ddi��y)a�
    Remove APT packages from the system.

    Setting DEBIAN_FRONTEND to noninteractive makes sure no prompts will
    appear during the operation. In this case, --force-confdef will
    automatically pick the default option when some debconf should appear.
    In the absence of a default option, --force-confold will automatically
    choose to keep the old configuration file.
    )r��remover��$-o Dpkg::Options::="--force-confdef"�$-o Dpkg::Options::="--force-confold"�DEBIAN_FRONTEND�noninteractive�rxN�r�r��r�r�s  r&�remove_packagesr���.���	
��}�
�	�	�,�.>�?�r%c�@�tgd�t|�z|ddi��y)a�
    Purge APT packages from the system - remove everything.

    Setting DEBIAN_FRONTEND to noninteractive makes sure no prompts will
    appear during the operation. In this case, --force-confdef will
    automatically pick the default option when some debconf should appear.
    In the absence of a default option, --force-confold will automatically
    choose to keep the old configuration file.
    )r��purger�r�r�r�r�r�Nr�r�s  r&�purge_packagesr��r�r%c�(�t|gd�ddi��y)a6
    Install packages, allowing downgrades.

    The --allow downgrades flag is needed because sometimes we need to
    reinstall the packages to a lower version (passed in the package_name
    string, as package=version).

    Setting DEBIAN_FRONTEND to noninteractive makes sure no prompts will
    appear during the operation. In this case, --force-confdef will
    automatically pick the default option when some debconf should appear.
    In the absence of a default option, --force-confold will automatically
    choose to keep the old configuration file.
    )z--allow-downgradesr�r�r�r�)r�rxN)r�)r�s r&�reinstall_packagesr��s����
�
-�.>�?�r%c���tjj�D]!}tjj|��#tj�tjSr;)r/r0r�r��init_configr�s r&�_get_apt_configr�sJ���~�~�"�"�$�"�������S�!�"������>�>�r%c�r�tt�5}|j|�}ddd�|S#1swYSxYwr;)r�r�r�)�base_key�apt_cfg�apt_cfg_keyss   r&�get_apt_config_keysr�!s:��	��	(�.�G��|�|�H�-��.���.���s�,�6�	cfg_namesc���i}tt�5}|D]8}|j|�}t|�s|j	|�xsd}|||<�:	ddd�|S#1swY|SxYw)z�
    Get all APT configuration values for the given config names. If
    one of the config names is not present on the APT config, that
    config name will have a value of None
    N)r�r�r1rT�
value_list)r��apt_cfg_dictr��cfg_name�	cfg_values     r&�get_apt_config_valuesr�(sv���L�	��	(�/�G�!�	/�H����H�-�I��y�>�#�.�.�x�8�@�D�	�%.�L��"�
	/�/���/���s�>A�A%c�P�d}d}tjj|�r|S|S)Nz/etc/apt/sources.listz&/etc/apt/sources.list.d/ubuntu.sources)rGrHrI)�old_sources_path�new_sources_paths  r&�get_system_sources_filer�>s5��.��?���7�7�>�>�*�+�	���r%)NN)Fr;)riN)xr�ru�enumrF�loggingrGrXr]rJ�	functoolsrr�typingrrrrr	r
rr/�apt.progress.baser�uaclientr
rrrrrr�uaclient.defaultsr�uaclient.files.state_filesrrOr&rAr@rDrdrarcr`rbrr�APT_METHOD_HTTPS_FILE�CA_CERTIFICATES_FILErerjrqrrrHrNr�rP�get_event_loggerr]�	getLogger�replace_top_level_logger_namerrR�unique�EnumrrTr'r7r<rgrur�r�r�r�r�r��boolr�r��retryr{r�r�r��Packager�r��Versionr�r�rrrr4r7r;r$rIrKrOrRrNr"rh�floatrorsryr�r�r�r�r�r�r�r�r�r$r%r&�<module>r�s��������	�	���&�I�I�I��-����.�8���*��)��3��+��
�� K�� L��?��A��)��$��4��9��G�� L��)��@����	�����_�&<�=�
�����_�&;�<��
	�����_�&:�;�
�����_�&=�>�
�����_�&F�G�
�����_�&A�B�	���"��%��%�%�'���g���:��:�:�8�D�E������D�I�I��
��
!��V�S�M�I�s�+;�f�c�]�K���
��)�s�)�s�)��)�'
�T#��#���X�#�P $�26�(�	
�c��(���}�(� ��S�#�X��/�(�	�	(�V�4��#�26����}����S�#�X��/��	������.��0
�c�
�h�s�m�
�,1�)��)�$(�)�
�c�]�)�Z37����S�#�X��/����.�����'�'��)C�)C�D���#/�3�#/�	�#/�P(,�26���3�i���$�s�)�$�� ��S�#�X��/��	�	�0�S��T�'�/�/�5J����S�M��	�'�/�/���0?C��
�_�_��.6�s�m��	�'�/�/���&���I��"��59��EH����@"�
���I�������	�
���
�	��@7.��7.��7.��7.�
��I�	7.�
�7.���9�
7.�
�7.�t,G�^B�2#'�	,��,��,���9�,��3�-�	,�

�,�*
4�-��,(�1�c�1�d�1�
��%8� 9�
� �d�3�i��!%�!%�+8�+?�+?�5A���
�5A��#��5A��-�(�5A�
�	5A�p�H�U�O���h�u�o��N���):�):� ;�N�7�*BP�J�4��9��S��0�$�s�)��C��0�d�3�i��2�����}��	�#�u�S�$�s�)�^�$�
$�%��,��r%
¿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!