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

�

�f(���ddlZddlZddlmZmZmZmZddlmZddlm	Z
ddlmZddl
mZeje�ZGd�dej$�Zy)	�N)�distros�helpers�subp�util)�PackageList)�	rhel_util)�HostnameConf)�PER_INSTANCEc��eZdZdZdZdgZdZdZdZdZ	dZ
d	Zd
Zddd
ddddd�d�iZ
d�Zd"d�Zdefd�Zd#d�Zd�Zd�Zd"d�Zd�Zd�Zd�Zd�Zd �Zed!��Zy)$�Distroz/etc/sysconfig/clockz
/etc/HOSTNAME�servicez/etc/sysconfig/languagez/etc/sysconfig/network/configz/etc/sysconfig/network/ifcfg-%sz!/etc/sysconfig/network/ifroute-%sz
/etc/hostnamez/etc/locale.confz/etc/localtime�	sysconfigzetc/sysconfig/network/config�susez%(base)s/network/ifcfg-%(name)sz3etc/udev/rules.d/85-persistent-net-cloud-init.rulesz!%(base)s/network/ifroute-%(name)s)�ipv4�ipv6)�control�flavor�iface_templates�
netrules_path�route_templatesc���tjj||||�tj|�|_d|_d|_d|_d|d<|j�rdg|_
d|d<yy)NrF�sshd�ssh_svcname�	systemctlzsshd.service)rr�__init__r�Runners�_runner�osfamily�
update_method�read_only_root�uses_systemd�init_cmd)�self�name�cfg�pathss    �</usr/lib/python3/dist-packages/cloudinit/distros/opensuse.pyrzDistro.__init__1so��������d�C��7����u�-�����
�!���#���#��M������(�M�D�M�!/�C�
���Nc��|j�r|s|j}d|i}n|s|j}d|i}tj||�y)N�LANG�RC_LANG)r!�systemd_locale_conf_fn�locale_conf_fn�rhutil�update_sysconfig_file)r#�locale�out_fn�
locale_cfgs    r'�apply_localezDistro.apply_locale<sN��������4�4�� �&�)�J���,�,��#�V�,�J��$�$�V�Z�8r(�pkglistc�,�|jdd|��y)N�installz--auto-agree-with-licenses)�args�pkgs)�package_command)r#r4s  r'�install_packageszDistro.install_packagesGs������8�w�	�	
r(c��|�g}|j�|jr%|jdk(stj	d�y|jdk(rddg}ngd�}|dk(rd}|s|jdk(r|dk(rd}gd	�}|d
k(rddg}|j|�|r"t
|t�r|j|�n#|r!t
|t�r|j|�tjd|�}|j|�tj|d�
�|jdk(rtjd�yy)N�
transactionalzUPackage operation requested but read only root without btrfs and transactional-updata�zypper�--non-interactive)�transactional-updater>�--drop-if-no-change�pkg�upgrade�update�up)r?r>r@�refreshz%s-%sF)�capturez8To use/activate the installed packages reboot the system)�_set_update_methodr r�LOG�error�append�
isinstance�str�list�extendr�expand_package_listr�info)r#�commandr7r8�cmdr4s      r'r9zDistro.package_commandLs=���<��D����!����t�'9�'9�_�'L��I�I�9�
�
�����)��0�1�C��C��i���G���"�"�o�5��8�#��G��C��i���0�1�C��
�
�7���J�t�S�)��J�J�t��
�j��t�,��J�J�t���*�*�7�D�9���
�
�7��	
�	�	�#�u�%�����0��H�H�J�
�1r(c�`�|j|�}|j�r@tj|j�tj
||j�ydt
|�i}tj|j|�tj||j�y)N�TIMEZONE)�
_find_tz_filer!r�del_file�tz_local_fn�sym_linkrLr.r/�
clock_conf_fn�copy)r#�tz�tz_file�	clock_cfgs    r'�set_timezonezDistro.set_timezone�s����$�$�R�(������
�M�M�$�*�*�+��M�M�'�4�#3�#3�4��C��G��I�
�(�(��);�);�Y�G��I�I�g�t�/�/�0r(c�`�|jjd|jdgt��y)Nzupdate-sourcesrE)�freq)r�runr9r
�r#s r'�update_package_sourceszDistro.update_package_sources�s-��������� � �
�K��		�	
r(c�`�|j�r4|jd�r#tj|�j	�S|j�r(tj
dg�\}}t
|�r|S|S	|j|�}|j}s|S|S#t$rY�wxYw)N�/previous-hostname�hostname)
r!�endswithr�load_text_file�stripr�len�_read_hostname_confrf�IOError)r#�filename�default�out�_err�confrfs       r'�_read_hostnamezDistro._read_hostname�s�������8�#4�#4�5I�#J��&�&�x�0�6�6�8�8�
�
�
�
 ��)�)�Z�L�1�K�S�$��3�x��
���
��/�/��9���=�=������O��	�
��
�s�>B!�!	B-�,B-c��y)Nz	127.0.1.1�rbs r'�_get_localhost_ipzDistro._get_localhost_ip�s��r(c�b�ttj|��}|j�|S�N)r	rrh�parse)r#rmrqs   r'rkzDistro._read_hostname_conf�s%���D�/�/��9�:���
�
���r(c�z�|j�r
|j}n|j}||j|�fSrw)r!�systemd_hostname_conf_fn�hostname_conf_fnrr)r#�host_fns  r'�_read_system_hostnamezDistro._read_system_hostname�s:�������3�3�G��+�+�G���,�,�W�5�6�6r(c��|j��tjd�}d}|r�|\}}}tjd�j	d�}|D]G}|j|�s�|j	�}|d|k7r�.|djd�|_n|j�d	k(r'tjjd
�rd|_yd|_ytjd
�d|_yy)z7Decide if we want to use transactional-update or zypperN�/�z/proc/mounts�
���ro�btrfsz/usr/sbin/transactional-updater<r=z7Could not determine filesystem type of '/' using zypper)
rr�get_mount_inforh�split�
startswithr �lower�os�path�existsrHrP)r#�result�fs_type�devpth�mount_point�mounts�mount�
mount_infos        r'rGzDistro._set_update_method�s������%��(�(��-�F��G��17�.���+��,�,�^�<�B�B�4�H��#��E��'�'��/�%*�[�[�]�
�%�a�=�K�7�$�.8��m�.F�.F�t�.L��+��
��=�=�?�g�-�"�'�'�.�.�4�3�*9�D�&�)1�D�&����M��&.��"�1&r(c�Z�tj|jdd�}|j�r(|j	d�rtj
||�y|j�rG|r"t
jddt|�g�yt
jdddt|�g�yd}	|j|�}|std�}|j|�tj
|t|�d	�y#t$r|rntjd�YyY�dwxYw)
N�create_hostname_fileTre�hostnamectlzset-hostnamez--transientz7create_hostname_file is False; hostname file notcreatedr�i�)r�get_cfg_option_bool�_cfgr!rg�
write_filerrLrkrlrHrPr	�set_hostname)r#rfrmr�rqs     r'�_write_hostnamezDistro._write_hostname�s��#�7�7��I�I�-�t� 
������8�#4�#4�5I�#J��O�O�H�h�/�
�
�
�
 �#��	�	�=�.�#�h�-�H�I��	�	�%�&�%��H�
�	���D�
��/�/��9���#�B�'�����h�'��O�O�H�c�$�i��7���
�'���H�H�"���
�
�s�4D�!D*�)D*c��|jsqtj�d}|d}t|dj	d�d�}|dk\rd|vs|dk\rd|vr|dk7rgd�|_|jSgd	�|_|jS)
z5The preferred ntp client is dependent on the version.�distrr��.��openSUSE�*)�chrony�systemd-timesyncd�ntp)r�r�r�)�_preferred_ntp_clientsr�system_info�intr�)r#�distro_infor$�	major_vers    r'�preferred_ntp_clientszDistro.preferred_ntp_clientss���
�*�*��*�*�,�V�4�K��q�>�D��K��N�0�0��5�a�8�9�I��R��J�d�$:��R��J�$�$6�9��?�/��+��*�*�*�
/��+��*�*�*r(rw)NN)�__name__�
__module__�__qualname__rYr{r"r-�network_conf_fn�network_script_tpl�route_conf_tplrzr,rW�renderer_configsrr3rr:r9r^rcrrrurkr}rGr��propertyr�rtr(r'rrs���*�M�&���{�H�.�N�5�O�:��8�N�.��/��"�K��5��@�E�<�;� �
�
��	0�	9�
��
�
;�z1� 
��&��
7�.�8$8�L�+��+r(r)�loggingr��	cloudinitrrrr�cloudinit.distrosrrr.�"cloudinit.distros.parsers.hostnamer	�cloudinit.settingsr
�	getLoggerr�rHrrtr(r'�<module>r�sC���	�2�2�)�1�;�+��g����!��I+�W�^�^�I+r(

Zerion Mini Shell 1.0