%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__/alpine.cpython-312.pyc

�

�f�"���ddlZddlZddlmZmZmZmZddlmZddl	m
Z
eje�Z
dZGd�dej�Zy)�N)�distros�helpers�subp�util)�HostnameConf)�PER_INSTANCEa7# 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}

c��eZdZdZdZdZdZdeed�iZdZ	dZ
d	�Zd
�Zd$d�Z
d
ejfd�Zd�Zd�Zd�Zd$d�Zd�Zdedededefd�Zd�Zd%d�Zd�Zed��Zd&d�Zed��Ze dd�d ed!ed"efd#��Z!y)'�Distrozpy3-pipz/usr/share/bkeymaps/z&/etc/profile.d/50-cloud-init-locale.shz/etc/network/interfaces�eni)�eni_path�
eni_headerz
/var/lib/dhcpzdhclient\.leasesc��tjj||||�tj|�|_d|_d|_d|d<y)NzC.UTF-8�alpine�sshd�ssh_svcname)rr
�__init__r�Runners�_runner�default_locale�osfamily)�self�name�cfg�pathss    �:/usr/lib/python3/dist-packages/cloudinit/distros/alpine.pyrzDistro.__init__)sE��������d�C��7����u�-���'��� ��
�#��M��c��|jS)zgThe default locale for Alpine Linux is different than
        cloud-init's DataSource default.
        )r�rs r�
get_localezDistro.get_locale3s���"�"�"rNc��|s|j}|s|j}ddddd|zddg}tj|dj	|�d�y)	N�#z?# This file is created by cloud-init once per new instance bootzexport CHARSET=UTF-8zexport LANG=%szexport LC_COLLATE=C��
�)r�locale_conf_fnr�
write_file�join)r�locale�out_fn�liness    r�apply_localezDistro.apply_locale9s^����(�(�F���(�(�F�
�M��"��v�%�!��
��	
�����	�	�%� 0�%�8r�pkglistc�J�|j�|jd|��y)N�add)�pkgs)�update_package_sources�package_command)rr,s  r�install_packageszDistro.install_packagesLs!���#�#�%����U���1rc�<�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 createdr"r$)�_read_hostname_conf�IOErrorr�get_cfg_option_bool�_cfg�LOG�infor�set_hostnamer&�str)r�hostname�filename�confr4s     r�_write_hostnamezDistro._write_hostnamePs�����	��+�+�H�5�D����#�D����(�#�����#�d�)�U�3���
	�#'�#;�#;��	�	�1�4�$� �$�����N����
	�s�A�AB�Bc�T�|j|j�}|j|fS�N)�_read_hostname�hostname_conf_fn)r�sys_hostnames  r�_read_system_hostnamezDistro._read_system_hostnamefs)���*�*�4�+@�+@�A���%�%�|�4�4rc�b�ttj|��}|j�|SrB)rr�load_text_file�parse)rr>r?s   rr5zDistro._read_hostname_confjs%���D�/�/��9�:���
�
���rc�l�d}	|j|�}|j}|s|S|S#t$rY�wxYwrB)r5r=r6)rr>�defaultr=r?s     rrCzDistro._read_hostnameosH����	��+�+�H�5�D��}�}�H���N����	�	��	�s�'�	3�3c��y)Nz	127.0.1.1�rs r�_get_localhost_ipzDistro._get_localhost_ipzs��r�layout�model�variant�optionsc���|s"d}tj|�t|��tjj|j|�}tjj|�s%d|z}tj|�t|��|s"d}tj|�t|��tjj|d|z�}tjj|�s%d|z}tj|�t|��|rtjd�|rtjd�tjd||g�y)	NzKeyboard layout not specified.z,Keyboard layout directory %s does not exist.zKeyboard variant not specified.z
%s.bmap.gzz(Keyboard variant file %s does not exist.z+Keyboard model is ignored for Alpine Linux.z.Keyboard options are ignored for Alpine Linux.zsetup-keymap)r9�error�RuntimeError�os�pathr'�keymap_path�isdir�isfile�warningr)rrOrPrQrR�msg�keymap_layout_path�keymap_variant_paths        r�
set_keymapzDistro.set_keymap}s���2�C��I�I�c�N��s�#�#��W�W�\�\�$�*:�*:�F�C���w�w�}�}�/�0�>�$�%�
�
�I�I�c�N��s�#�#��3�C��I�I�c�N��s�#�#� �g�g�l�l���w� 6�
���w�w�~�~�1�2�:�%�&�
�
�I�I�c�N��s�#�#���K�K�E�F���K�K�H�I��	�	�>�6�7�3�4rc�P�tj||j|���y)N)�tz�tz_file)r�set_etc_timezone�
_find_tz_file)rras  r�set_timezonezDistro.set_timezone�s��� � �B��0B�0B�2�0F�Grc��|�g}dg}|jd�|r"t|t�r|j|�n#|r!t|t�r|j	|�|r|j|�|dk(r|j	ddg�tjd|�}|j	|�tj|d��y)	N�apkz--quiet�upgradez--update-cachez--availablez%s-%sF)�capture)�append�
isinstancer<�list�extendr�expand_package_listr)r�command�argsr/�cmdr,s      rr1zDistro.package_command�s����<��D��g���
�
�9���J�t�S�)��J�J�t��
�j��t�,��J�J�t����J�J�w���i���J�J�(�-�8�9��*�*�7�D�9���
�
�7��	
�	�	�#�u�%rc�`�|jjd|jdgt��y)Nzupdate-sources�update)�freq)r�runr1rrs rr0zDistro.update_package_sources�s-��������� � �
�J��		�	
rc�D�|js	ddg|_|jS)z7Allow distro to determine the preferred ntp client list�chrony�ntp)�_preferred_ntp_clientsrs r�preferred_ntp_clientszDistro.preferred_ntp_clients�s&���*�*�+3�U�*;�D�'��*�*�*rc��|dg}|dk(r|dgz
}|S	|jtt|�dz��|S#t$r}t	d|�d��|�d}~wwxYw)Nz-d�now�0�<z;power_state[delay] must be 'now' or '+m' (minutes). found 'z'.)rjr<�int�
ValueError�	TypeError)r�mode�delay�messagero�es      r�shutdown_commandzDistro.shutdown_command�sz����,���E�>���u��G���
����s�3�u�:��?�3�4����
�
��&+�.�����
�s�&;�	A�A�Ac��y)z1
        Alpine uses OpenRC, not systemd
        FrMrMrr�uses_systemdzDistro.uses_systemd�s��
r)�rcs�action�service�
extra_argsc
�T�ddg}ddg}t|�|dgzt|�|dgzt|�d|gzt|�d|gzt|�|dgzt|�|dgzt|�|dgzt|�|d	gzd
�}t||�}tj|d|��S)
a<
        Perform the requested action on a service. This handles OpenRC
        specific implementation details.

        OpenRC has two distinct commands relating to services,
        'rc-service' and 'rc-update' and the order of their argument
        lists differ.
        May raise ProcessExecutionError
        z
rc-servicez	--nocolorz	rc-update�stop�start�delr.�restart�status)r�r��disable�enabler��reloadz
try-reloadr�T)rir�)rlr)	rr�r�r�r��init_cmd�
update_cmd�cmdsrqs	         r�manage_servicezDistro.manage_service�s���!�+�.��!�;�/�
���N�g�v�%6�6��(�^�w��&8�8��J�'�5�'�*:�:��:�&�%��)9�9��H�~��)�(<�<��8�n���';�;��x�.�G�Y�+?�?��8�n���':�:�	
���4��<� ���y�y��d��4�4rrB)NN)�poweroffr|N)"�__name__�
__module__�__qualname__�pip_package_namerXr%�network_conf_fn�NETWORK_FILE_HEADER�renderer_configs�dhclient_lease_directory�dhclient_lease_file_regexrrr+r�PackageListr2r@rFr5rCrNr<r_rer1r0�propertyrzr��staticmethodr��classmethodr�rMrrr
r
s�� ��(�K�=�N�/�O�
�O�;N�O���
 /�� 3��$�#�9�&2��(;�(;�2�4�,5��
	�� 5�� 5�S� 5�3� 5�� 5�DH�&�2
��+��+��4�����?C�5��5�$'�5�69�5��5rr
)�loggingrV�	cloudinitrrrr�"cloudinit.distros.parsers.hostnamer�cloudinit.settingsr�	getLoggerr�r9r�r
rMrr�<module>r�sE���	�2�2�;�+��g����!����j5�W�^�^�j5r

Zerion Mini Shell 1.0