%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /lib/python3/dist-packages/cloudinit/distros/__pycache__/
Upload File :
Create Path :
Current File : //lib/python3/dist-packages/cloudinit/distros/__pycache__/debian.cpython-312.pyc

�

�f�(����ddlZddlZddlmZddlmZmZmZddlm	Z	ddl
mZddlm
Z
ddlmZej e�ZdZd	Zd
ZGd�dej,�Zdd
�Zedfd�Zdd�Zdd�Zy)�N)�List)�distros�subp�util)�Apt)�PackageManager)�HostnameConf)�CLOUDINIT_NETPLAN_FILEa8# This file is generated from information provided by the datasource.  Changes
# to it will not persist across an instance reboot.  To disable cloud-init's
# network configuration capabilities, write a file
# /etc/cloud/cloud.cfg.d/99-disable-network-config.cfg with the following:
# network: {config: disabled}
�'/etc/network/interfaces.d/50-cloud-initz/etc/default/localec���eZdZdZded�Zeded�ededd�d�Zd	Zd
Z	�fd�Z
d�Zdd
�Z�fd�Z
d�Zd�Zd�Zdd�Zd�Zd�Zdd�Zd�Zdedededefd�Z�xZS)�Distroz
/etc/hostnamer)�eni�netplanr)�eni_path�
eni_headerrT)�netplan_path�netplan_header�postcmdsz
/var/lib/dhcpzdhclient\.\w+\.leasesc���t�|�|||�d|_d|_d|_tj|j|�|_|jg|_	y)N�debianzC.UTF-8)
�super�__init__�osfamily�default_locale�
system_localer�from_config�_runner�apt�package_managers)�self�name�cfg�paths�	__class__s    ��:/usr/lib/python3/dist-packages/cloudinit/distros/debian.pyrzDistro.__init__8sQ���
����s�E�*�!��
�'���!����?�?�4�<�<��5���7;�x�x�j���c��|jst�|_|jr|jS|jS)z9Return the default locale if set, else use default locale)r�read_system_localer�r s r%�
get_localezDistro.get_localeCs>���!�!�!3�!5�D��#'�"4�"4�D���	
�:>�:M�:M�	
r&c�@�|st}|std��|j�}tjj|�}|j}|r&tjdt|j�n%tjd|jt�|j�|j�k7xs|xs|}|xs|xs|}|rt|||��n"tjd||j|�|rt|||��d|_yy)zeApply specified locale to system, regenerate if specified locale
        differs from system default.zFailed to provide locale value.zVSystem locale not found in %s. Assuming system locale is %s based on hardcoded defaultzSystem locale set to %s via %s)�keynamez9System has '%s=%s' requested '%s', skipping regeneration.N)
�LOCALE_CONF_FN�
ValueErrorr*�os�path�existsr�LOG�debugr�lower�regenerate_locale�update_locale_conf)	r �locale�out_fnr,�
distro_locale�conf_fn_exists�sys_locale_unset�
need_regen�	need_confs	         r%�apply_localezDistro.apply_localeNs���#�F���>�?�?����)�
�������/��#�1�1�1����I�I�J���#�#�	
�
�I�I�0��"�"��
�
�L�L�N�m�1�1�3�3�
 �!�!�
 ��	�
'�&�H�*�H�8H�	���f�f�g�>��I�I�K���"�"��	
���v�v�w�?�!%�D��r&c�6��t�t�|�|i|��S�N)�_maybe_remove_legacy_eth0r�_write_network_state)r �args�kwargsr$s   �r%rBzDistro._write_network_states���!�#��w�+�T�<�V�<�<r&c�<�d}	|j|�}|std�}|j|�tj|t|�d�y#t$r>tj|jdd�}|rnt
j
d�YyY��wxYw)N�create_hostname_fileTz8create_hostname_file is False; hostname file not created��)�_read_hostname_conf�IOErrorr�get_cfg_option_bool�_cfgr2�infor	�set_hostname�
write_file�str)r �hostname�filename�confrFs     r%�_write_hostnamezDistro._write_hostname�s�����	��+�+�H�5�D����#�D����(�#�����#�d�)�U�3���
	�#'�#;�#;��	�	�1�4�$� �$�����N����
	�s�A�AB�Bc�T�|j|j�}|j|fSr@)�_read_hostname�hostname_conf_fn)r �sys_hostnames  r%�_read_system_hostnamezDistro._read_system_hostname�s)���*�*�4�+@�+@�A���%�%�|�4�4r&c�b�ttj|��}|j�|Sr@)r	r�load_text_file�parse)r rRrSs   r%rIzDistro._read_hostname_conf�s%���D�/�/��9�:���
�
���r&c�l�d}	|j|�}|j}|s|S|S#t$rY�wxYwr@)rIrQrJ)r rR�defaultrQrSs     r%rVzDistro._read_hostname�sH����	��+�+�H�5�D��}�}�H���N����	�	��	�s�'�	3�3c��y)Nz	127.0.1.1�r)s r%�_get_localhost_ipzDistro._get_localhost_ip�s��r&c�P�tj||j|���y)N)�tz�tz_file)r�set_etc_timezone�
_find_tz_file)r rcs  r%�set_timezonezDistro.set_timezone�s��� � �B��0B�0B�2�0F�Gr&c�b�|dk7rtd|�d���|jjd�y)N�upgradezUnable to handle z command)�RuntimeErrorr�run_package_command)r �commandrC�pkgss    r%�package_commandzDistro.package_command�s3���i���!2�7�)�8�D�E�E����$�$�Y�/r&c�*�tj�Sr@)r�get_dpkg_architecturer)s r%�get_primary_archzDistro.get_primary_arch�s���)�)�+�+r&�layout�model�variant�optionsc��djddd|�d�d|�d�d|�d�d|�d�dd	dg	�}tjd
|dd�
�|jdd�y)N�
z'# This file was generated by cloud-initrGz
XKBMODEL="�"zXKBLAYOUT="zXKBVARIANT="zXKBOPTIONS="zBACKSPACE="guess"z/etc/default/keyboardrH�w)rR�content�mode�omode�restartz
console-setup)�joinrrO�manage_service)r rrrsrtru�contentss      r%�
set_keymapzDistro.set_keymap�s����9�9�9���U�G�1�%��f�X�Q�'��w�i�q�)��w�i�q�)��#��

�
��	
���,����		
�	
���I��7r&)N�LANGr@)NN)�__name__�
__module__�__qualname__rWr
�network_conf_fn�NETWORK_FILE_HEADER�renderer_configs�dhclient_lease_directory�dhclient_lease_file_regexrr*r>rBrTrYrIrVrargrnrqrPr��
__classcell__)r$s@r%r
r
"s����&��8�)��O�(��.�-�
�
,�I�6�1��
�
�� /�� 8��	A�	
�/&�b=�4�,5��
	��H�0�,� 8�� 8�S� 8�3� 8�� 8r&r
c��tjj|�syd}	tj|�}ddg}|j�D�cgc]$}|j
d�r�|j���&}}||k(rtj|�d|z}n|d|zz}tj|�ycc}w#t$r|d|zz}Y�.wxYw)	aOUbuntu cloud images previously included a 'eth0.cfg' that had
    hard coded content.  That file would interfere with the rendered
    configuration if it was present.

    if the file does not exist do nothing.
    If the file exists:
      - with known content, remove it and warn
      - with unknown content, leave it and warn
    Nz(Dynamic networking config may not apply.z	auto eth0ziface eth0 inet dhcp�#zremoved %s with known contentsz* '%s' exists with user configured content.z" %s exists, but could not be read.)r/r0r1rr[�
splitlines�
startswith�strip�del_file�	Exceptionr2�warning)r0�bmsgr��known_contents�f�lines�msgs       r%rArA�s����7�7�>�>�$���5�D�A��&�&�t�,��%�'=�>��'�2�2�4�
��A�L�L��<M�A�G�G�I�
��
��N�"��M�M�$��2�T�9�C��E��L�L�C��K�K����
���A��9�D�@�@��A�s)�+B=�B8�&B8�8*B=�8B=�=C�Cr�c���d}|std|z��tjj|�r<t	j
|�}t	j|�}|j|d�}|S)z.Read system default locale setting, if presentrGzInvalid path: %s)r.r/r0r1rr[�load_shell_content�get)�sys_pathr,�sys_val�locale_content�sys_defaultss     r%r(r(sb���G���+�h�6�7�7�	�w�w�~�~�h���,�,�X�6���.�.�~�>���"�"�7�B�/���Nr&c�x�tjd|||�tjdd|z|�d|��gd��y)zUpdate system locale configz%Updating %s with locale setting %s=%sz
update-localez--locale-file=�=F��captureN)r2r3r�r7r�r,s   r%r6r6sB���I�I�/��7�F��	�I�I���x�'���'�	
�
�
r&c��|j�dvrtjd||�ytjd|�tjd|gd��y)z�
    Run locale-gen for the provided locale and set the default
    system variable `keyname` appropriately in the provided `sys_path`.

    )�czc.utf-8�posixz$%s=%s does not require rengenerationNzGenerating locales for %sz
locale-genFr�)r4r2r3rr�s   r%r5r5sK���|�|�~�2�2��	�	�8�'�6�J���I�I�)�6�2��I�I�|�V�$�e�4r&)z"/etc/network/interfaces.d/eth0.cfg)r�)�loggingr/�typingr�	cloudinitrrr�(cloudinit.distros.package_management.aptr�4cloudinit.distros.package_management.package_managerr�"cloudinit.distros.parsers.hostnamer	�cloudinit.net.netplanr
�	getLoggerr�r2r��NETWORK_CONF_FNr-r
rAr(r6r5r`r&r%�<module>r�sw���	��)�)�8�O�;�8��g����!����<��&��|8�W�^�^�|8�~�@!/����5r&

Zerion Mini Shell 1.0