%PDF- %PDF-
Mini Shell

Mini Shell

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

�

���f�!���ddlZddlZddlmZddlmZmZmZddlm	Z	ddl
mZddlm
Z
ddlmZej e�ZGd�d	e
j&�Zy)
�N)�Optional)�net�subp�util)�	bsd_utils)�
ResolvConf)�renderer)�NetworkStatec��eZdZdZdZdZdZdZd�Zd�Z	dd�Z
d�Zd	�Zd
�Z
		ddedeed
dfd�Zd�Zdd�Zdd�Zd�Zd�Zy)�BSDRendererzetc/resolv.confzetc/rc.conf�c��tj|j|j�}t	j
||��y�N)�fn)r�target_path�target�
rc_conf_fnr�get_rc_config_value)�self�keyrs   �3/usr/lib/python3/dist-packages/cloudinit/net/bsd.pyrzBSDRenderer.get_rc_config_values,��
�
�
�d�k�k�4�?�?�
;���%�%�c�b�1�c��tj|j|j�}t	j
|||��yr)rrrrr�set_rc_config_value)rr�valuers    rrzBSDRenderer.set_rc_config_values.��
�
�
�d�k�k�4�?�?�
;���%�%�c�5�R�8rNc�d�|si}d|_i|_i|_|jdd�|_y)N�postcmdsT)r�interface_configurations�interface_configurations_ipv6�get�	_postcmds)r�configs  r�__init__zBSDRenderer.__init__s3����F����(*��%�-/��*����J��5��rc
��tj�}|j�D�]�}|jd�}|jd�}|rt	j
d|�r�?||vrtjd|�n>|r7|r5||}||k7r0tjd||�	|j||�n||}tjd|�|jdg�D�]�}|jd	�d
k(r�|jd�s&tjd|jd
���Otjd||jd
�|jd��|jd
�|jd�|jd�xs|jd�d�|j|<��|jd	�dk(r�|jd�s'tjd|jd
����%tjd||jd
�|jd��|jd
�|jd�|jd�xs|jd�d�|j|<���|jd	�dk(s|jd	�dk(s���d|j|<������y#t$rtjd�|}Y��;wxYw)N�name�mac_addressz^lo\d+$z"Cannot find any device with MAC %sz,netif service will rename interface %s to %sz.Interface renaming is not supported on this OSzConfiguring interface %s�subnets�type�static�netmaskz+Skipping IP %s, because there is no netmask�addresszConfiguring dev %s with %s / %s�mtu)r+r*r,�static6�prefixz*Skipping IP %s, because there is no prefix)r+r.r,�dhcp�dhcp4�DHCP)r�get_interfaces_by_mac�iter_interfacesr �re�match�LOG�info�rename_interface�NotImplementedError�error�debugrr)r�settings�
ifname_by_mac�	interface�device_name�
device_mac�cur_name�subnets        r�_ifconfig_entrieszBSDRenderer._ifconfig_entries's����1�1�3�
�!�1�1�3�H	H�I�#�-�-��/�K�"���}�5�J��r�x�x�
�K�@����.����=�z�J���(��4���{�*��H�H�F� �#��
/��-�-�h��D�,�J�7���H�H�/��=�#�-�-�	�2�6�,
H���:�:�f�%��1�!�:�:�i�0��	�	�I�"�J�J�y�1��!��I�I�9�#��
�
�9�-��
�
�9�-�	�$*�:�:�i�#8�#)�:�:�i�#8�%�z�z�%�0�H�I�M�M�%�4H�B�D�1�1�+�>��Z�Z��'�9�4�!�:�:�h�/��	�	�H�"�J�J�y�1��!��I�I�9�#��
�
�9�-��
�
�8�,�	�$*�:�:�i�#8�"(�*�*�X�"6�%�z�z�%�0�H�I�M�M�%�4H�G�D�6�6�{�C��J�J�v�&�&�0��z�z�&�)�W�4�AG�D�1�1�+�>�Y,
H�9H	H��"/�/��	�	�L��'/��	/�s�%K� K9�8K9c�4�t|j��}|j�D]�}|jdg�}|D]�}|jd�dk(rF|jd�}|r�t	|jd��dk(rq|j
dd|d��n[|jd�d	k(rF|jd�}|r4t	|jd
��dkDr|j
dd
|d��n��||jdg�z
}����|D]�}|jd�}|stjd��,|jd�r|jd�n|jd�}	|jd�}|j||	|���y)Nr'r(r)�gateway�.�z0.0.0.0)�networkr*rEr-�:�z::�0)rHr.rE�routesrHzSkipping a bad route entryr*r.)
�list�iter_routesr3r �len�split�appendr6r;�	set_route)
rr<rLr>r'rBrE�routerHr*s
          r�_route_entrieszBSDRenderer._route_entriesss����h�*�*�,�-��!�1�1�3�	3�I��m�m�I�r�2�G�!�
3���:�:�f�%��1�$�j�j��3�G��3�w�}�}�S�'9�#:�a�#?��
�
�+4�+4�+2����Z�Z��'�9�4�$�j�j��3�G��3�w�}�}�S�'9�#:�Q�#>��
�
�+/�*-�+2�����&�*�*�X�r�2�2��/
3�	3�6�	6�E��i�i�	�*�G���	�	�6�7���9�9�Y�'��	�	�)�$��Y�Y�x�(�
�
�i�i�	�*�G��N�N�7�G�W�5�	6rc	�:�|j}|j}|j�D]J}|jdg�D]3}d|vr|j	|d�d|vs� |j	|d��5�L	tt
jtj|j|j���}|j�t!|�D]}	|j#|��t!|�D]}	|j'|��t
j(tj|j|j�t+|�d�y#t$rat
jtdtj|j|j��td�}|j�Y��wxYw#t$$rt
jtd|�Y��wxYw#t$$rt
jtd|�Y��wxYw)	Nr'�dns_nameservers�
dns_searchz&Failed to parse %s, use new empty filer
zFailed to add nameserver %szFailed to add search domain %si�)rV�dns_searchdomainsr3r �extendrr�load_text_filerrr�resolv_conf_fn�parse�IOError�logexcr6�set�add_nameserver�
ValueError�add_search_domain�
write_file�str)	rr<�nameservers�
searchdomainsr>rB�
resolvconf�server�domains	         r�
_resolve_confzBSDRenderer._resolve_conf�s����.�.�� �2�2�
�!�1�1�3�	?�I�#�-�-�	�2�6�
?��$��.��&�&�v�.?�'@�A��6�)�!�(�(���)=�>�	
?�	?�	�#��#�#��$�$�T�[�[�$�2E�2E�F���J�

�����+�&�	H�F�
H��)�)�&�1�	H��-�(�	K�F�
K��,�,�V�4�	K�
	
������T�[�[�$�*=�*=�>��
�O��	
��-�	��K�K��8�� � ����d�.A�.A�B�
�
$�B��J�����	���
H����C�!>��G�
H���
K����C�!A�6�J�
K�s8�7AE�G�>G2�A'G�G�$G/�.G/�2$H�H�
network_state�	templates�returnc���|r||_|j|��|j|��|j|��|j	�|j|j��y)N)r<)�run)rrCrTrj�write_config�start_servicesr!)rrkrlrs    r�render_network_statez BSDRenderer.render_network_state�sb��� �D�K����
��6����]��3����M��2������������/rc�z�|jj}|�D��cgc]
\}}|dk(s�|��c}}Scc}}w)Nr1)r�items)r�ic�k�vs    r�dhcp_interfaceszBSDRenderer.dhcp_interfaces�s3��
�
*�
*�
0�
0�� �d�2�d�a��a�6�k��2�2��2s�
7�7c��t���N�r9)rros  rrqzBSDRenderer.start_services����!�#�#rc��t��rzr{)rrs  rrpzBSDRenderer.write_config�r|rc��t��rzr{)rrAr?s   rr8zBSDRenderer.rename_interface�r|rc��t��rzr{)rrHr*rEs    rrRzBSDRenderer.set_route�r|rrz)NN)F)�__name__�
__module__�__qualname__r[r�interface_routes�route_names�route6_namesrrr#rCrTrjr
r�dictrrrxrqrpr8rR�rrrrs���&�N��J����K��L�2�9�6�JH�X(6�T,
�b%)��	
0�#�
0��D�>�
0�

�
0�3�$�$�$�$rr)�loggingr4�typingr�	cloudinitrrr�cloudinit.distrosr�%cloudinit.distros.parsers.resolv_confr�
cloudinit.netr	�cloudinit.net.network_stater
�	getLoggerr�r6�Rendererrr�rr�<module>r�sH���	��%�%�'�<�"�4��g����!��X$�(�#�#�X$r

Zerion Mini Shell 1.0