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

�

�f>����ddlZddlZddlmZmZddlmcmcmZddl	m
Z
mZmZmZm
Z
ddlmZmZddlmZej&e�ZGd�de
j,�Zy)�N)�List�Optional)�distros�helpers�net�subp�util)�PackageList�	bsd_utils)�
BSDNetworkingc�4��eZdZUeZdZdZdZdddd�ZgZ	e
eed<gZ
e
eed<gZe
eed	<d
Zee
eed<d
Zee
eed<ej&Z�fd
�Zd�Zdd�Zd�Zd�Zdd�Zd�Zdefd�Zd�Zdd�Zd�Z dd�Z!de"de#fd�Z$e%d��Z&�xZ'S) �BSD�/etc/rc.confz
root:wheelz-H�-pz-r)�halt�poweroff�reboot�group_add_cmd_prefix�pkg_cmd_install_prefix�pkg_cmd_remove_prefixN�pkg_cmd_update_prefix�pkg_cmd_upgrade_prefixc����t�|�|||�tj|�|_d|d<d|d<tj�j�|_tj|_y)N�sshd�ssh_svcname�rsyslogd�rsyslog_svcname)�super�__init__r�Runners�_runner�platform�system�lower�osfamily�
bsd_netops�	BsdNetOps�net_ops)�self�name�cfg�paths�	__class__s    ��7/usr/lib/python3/dist-packages/cloudinit/distros/bsd.pyrzBSD.__init__ s_���
����s�E�*����u�-���#��M��!+���� ���)�/�/�1��
�!�+�+���c�T�|j|j�}|j|fS�N)�_read_hostname�hostname_conf_fn)r)�sys_hostnames  r.�_read_system_hostnamezBSD._read_system_hostname+s)���*�*�4�+@�+@�A���%�%�|�4�4r/c�,�tjd�S)N�hostname)r�get_rc_config_value)r)�filename�defaults   r.r2zBSD._read_hostname/s���,�,�Z�8�8r/c��td��)Nz&Return list cmd to add member to group��NotImplementedError)r)�member_name�
group_names   r.�_get_add_member_to_group_cmdz BSD._get_add_member_to_group_cmd2s��!�"J�K�Kr/c�4�tjd|d��y)Nr7r)�fn)r�set_rc_config_value)r)r7r9s   r.�_write_hostnamezBSD._write_hostname5s���%�%�j�(�~�Nr/c�h�tj|�rtjd|�n<|j|gz}	tj
|�tj
d|�|sg}|D]l}tj|�stjd||��0	tj
|j||��tj
d||��ny#t$rtjtd|�Y��wxYw#t$rtjtd||�Y��wxYw)Nz(Skipping creation of existing group '%s'zCreated new group %szFailed to create group %szCUnable to add group member '%s' to group '%s'; user does not exist.zAdded user '%s' to group '%s'z%Failed to add user '%s' to group '%s')r	�is_group�LOG�warningrr�info�	Exception�logexc�is_userr@)r)r*�members�
group_add_cmd�members     r.�create_groupzBSD.create_group8s
���=�=����K�K�B�D�I� �5�5���>�M�
D��	�	�-�(����/��6���G��	�F��<�<��'����-���	��
��	�	�$�;�;�F�D�I�J����8�&�$�G�	���
D����C�!<�d�C�
D��"�
�����@�&�$��
�s#�+C� <D	�$D�D�	%D1�0D1c��gdd�}tj�j�D]!\}}|djd||ddigd���#|S)N�)�config�versionrS�physical�type�dhcp)rVr*�mac_address�subnets)r�get_interfaces_by_mac�items�append)r)�nconf�macr*s    r.�generate_fallback_configzBSD.generate_fallback_configVsc���!�,���2�2�4�:�:�<�	�I�C���(�O�"�"�&� �#&�!'�� 0�1�	�
�	��r/�pkglistc�J�|j�|jd|��y)N�install)�pkgs)�update_package_sources�package_command)r)r`s  r.�install_packageszBSD.install_packagescs!���#�#�%����Y�W��5r/c��td��)z?Return environment vars used in *BSD package_command operationsz(BSD subclasses return a dict of env varsr<)r)s r.�_get_pkg_cmd_environzBSD._get_pkg_cmd_environgs��!�"L�M�Mr/c��|�g}|dk(r
|j}nO|dk(r
|j}n=|dk(r|jsy|j}n|dk(r|jsy|j}|r"t	|t
�rj
|�n#|r!t	|t�rj|�tjd|�}j|�tj||j�d��y)Nrb�remove�update�upgradez%s-%sF)�
update_env�capture)
rrrr�
isinstance�strr\�list�extendr	�expand_package_listrrh)r)�command�argsrc�cmdr`s      r.rezBSD.package_commandks����<��D��i���-�-�C�
��
 ��,�,�C�
��
 ��-�-���,�,�C�
�	�
!��.�.���-�-�C��J�t�S�)��J�J�t��
�j��t�,��J�J�t���*�*�7�D�9���
�
�7��	
�	�	�#�$�";�";�"=�u�Mr/c�P�tj||j|���y)N)�tz�tz_file)r�set_etc_timezone�
_find_tz_file)r)rxs  r.�set_timezonezBSD.set_timezone�s��� � �B��0B�0B�2�0F�Gr/c�.�tjd�y)NzCannot set the locale.)rG�debug)r)�locale�out_fns   r.�apply_localezBSD.apply_locale�s���	�	�*�+r/�plist_in�hashedc�@�|D]\}}|j|||���y)N)r�)�
set_passwd)r)r�r�r*�passwords     r.�chpasswdzBSD.chpasswd�s'��&�	;�N�D�(��O�O�D�(�6�O�:�	;r/c�~�tjdddt|�g�\}}t|j��S)zC
        Return the parent pid of a process by checking ps
        �psz-oppid=r)rrp�int�strip)�pid�ppid�_s   r.�
get_proc_ppidzBSD.get_proc_ppid�s4��
�)�)�T�9�d�C��H�=�>���a��4�:�:�<� � r/r1)NN)(�__name__�
__module__�__qualname__r�networking_clsr3�
rc_conf_fn�
default_owner�shutdown_options_maprrrp�__annotations__rrrrrr&r'r(rr5r2r@rDrPr_r
rfrhrer|r�rq�boolr��staticmethodr��
__classcell__)r-s@r.rr
s����"�N�%���J� �M�%)�d�d�K��')��$�s�)�(�(*��D��I�*�')��4��9�)�15��8�D��I�.�5�26��H�T�#�Y�/�6��"�"�G�	,�5�9�L�O��<�6��6�N�N�8H�,�;��;�t�;��!��!r/r)�loggingr"�typingrr�cloudinit.net.netops.bsd_netopsr�netopsr&�	cloudinitrrrr	�cloudinit.distrosr
r�cloudinit.distros.networkingr�	getLoggerr�rG�Distror�r/r.�<module>r�sD����!�4�4�7�7�4�6��g����!��J!�'�.�.�J!r/

Zerion Mini Shell 1.0