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

�

�f���UddlZddlZddlZddlZddlmZddlZddlmZm	Z		ddl
Z
e
jZeje
je
je���Zeed<ej,e�ZGd�d	ej2j4j6�ZGd
�de�Zy#eef$r%	ddlmZej*Zn#e$rd�ZYnwxYwY�rwxYw)�N)�Any)�subp�util)�salt�
blowfish_hash)�bcryptc��td��)z�Raise when called so that importing this module doesn't throw
            ImportError when this module is not used. In this case, crypt
            and passlib are not needed.
            z/crypt and passlib not found, missing dependency)�ImportError)�_s �:/usr/lib/python3/dist-packages/cloudinit/distros/netbsd.pyrrs��
�A��
�c�`��eZdZdZdZdgZ�fd�Zd�Zd�Zd
d�Z	d�Z
d	�Zdd
�Zd�Z
d�Z�xZS)�NetBSDzS
    Distro subclass for NetBSD.

    (N.B. OpenBSD inherits from this class.)
    z*/usr/pkg/etc/sudoers.d/90-cloud-init-users�groupaddc����t�|�|||�tjj	d�r%gd�|_gd�|_gd�|_gd�|_yddg|_dg|_y)	Nz/usr/pkg/bin/pkgin)�pkgin�-y�install)rr�remove)rr�update)rrzfull-upgrade�pkg_addz-U�
pkg_delete)	�super�__init__�os�path�exists�pkg_cmd_install_prefix�pkg_cmd_remove_prefix�pkg_cmd_update_prefix�pkg_cmd_upgrade_prefix)�self�name�cfg�paths�	__class__s    �rrzNetBSD.__init__4s\���
����s�E�*�
�7�7�>�>�.�/�*D�D�'�)B�D�&�)B�D�&�*I�D�'�+4�d�*;�D�'�*6��D�&r
c��dd||gS)N�usermod�-G�)r"�member_name�
group_names   r�_get_add_member_to_group_cmdz#NetBSD._get_add_member_to_group_cmd?s���4��[�9�9r
c��tj|�rtjd|�ydg}dg}dddddd	�}d
ddd
�}|j	�D]b\}}||vr)|r't|t�r|j|||g��3||vs�8|s�;|j||�|j||��dd|vsd|vr|dgz
}|dgz
}||gz
}||gz
}tjd|�	tj||��|jdd�}	|	�|j||	d��yy#t$rtjtd|��wxYw)Nz!User %s already exists, skipping.F�useraddz-dz-cz-gr)z-s)�homedir�gecos�
primary_group�groups�shellz--no-user-groupz--systemz
--no-log-init)�
no_user_group�system�no_log_init�no_create_homer6z-mzAdding user %s)�	logstringzFailed to create user %s�passwdT)�hashed)r�is_user�LOG�info�items�
isinstance�str�extend�appendr�	Exception�logexc�get�
set_passwd)
r"r#�kwargs�adduser_cmd�log_adduser_cmd�adduser_opts�
adduser_flags�key�val�
passwd_vals
          r�add_userzNetBSD.add_userBs����<�<����H�H�8�$�?�� �k��$�+����!���
��/� �*�
�
�����	;�H�C���l�"�s�z�#�s�/C��"�"�L��$5�s�#;�<��
�%�#��"�"�=��#5�6��&�&�}�S�'9�:�
	;��6�)�X�V�-C��D�6�!�K���v�%�O���v����D�6�!��	���!�4�(�	��I�I�k�_�=��Z�Z��$�/�
��!��O�O�D�*�T�O�:�"��
�	��K�K��7��>��	�s�-D.�.&Ec���|r|}nt|�}	tjdd||g�|j
|�y#t$rtjt
d|��wxYw)Nr(z-pzFailed to set password for %s)rrrDrrEr=�
unlock_passwd)r"�userr:r;�	hashed_pws     rrGzNetBSD.set_passwdssc����I�%�f�-�I�	��I�I�y�$�	�4�8�9�	
���4� ���	��K�K��<�d�C��	�s	�=�&A#c��	tjddd|g�y#t$rtjtd|��wxYw)Nr(�-C�yeszFailed to lock user %s�rrDrrEr=�r"r#s  r�lock_passwdzNetBSD.lock_passwd�s?��	��I�I�y�$��t�4�5���	��K�K��5�t�<��	��	��&Ac��	tjddd|g�y#t$rtjtd|��wxYw)Nr(rV�nozFailed to unlock user %srXrYs  rrRzNetBSD.unlock_passwd�s?��	��I�I�y�$��d�3�4���	��K�K��7��>��	�r[c�.�tjd�y)NzCannot set the locale.)r=�debug)r"�locale�out_fns   r�apply_localezNetBSD.apply_locale�s���	�	�*�+r
c�h�tj�}tj�}dd|�d|�d�iS)z9Return env vars used in NetBSD package_command operations�PKG_PATHz1http://cdn.netbsd.org/pub/pkgsrc/packages/NetBSD/�/z/All)�platform�release�machine)r"�
os_release�os_archs   r�_get_pkg_cmd_environzNetBSD._get_pkg_cmd_environ�sB���%�%�'�
��"�"�$�����9�A�j�\��/�
�	
r
c��y�Nr*)r"s r�update_package_sourceszNetBSD.update_package_sources�s��r
)Frm)�__name__�
__module__�__qualname__�__doc__�
ci_sudoers_fn�group_add_cmd_prefixrr-rPrGrZrRrbrkrn�
__classcell__)r&s@rrr*sF����A�M�&�<��	8�:�/;�b!���,�	
�
r
rc��eZdZy)�DistroN)rorprqr*r
rrwrw�s��r
rw)�	functools�loggingrrf�typingr�cloudinit.distros.bsd�	cloudinitrr�crypt�METHOD_BLOWFISHr�partial�mksaltr�__annotations__r
�AttributeError�passlib.hashr�hash�	getLoggerror=�distros�bsd�BSDrrwr*r
r�<module>r�s���
��	���� ���� � �D�*��*�*�
���
�U�\�\�$�
��M�3��*�g����!��s
�Y�
�
�
"�
"�
&�
&�s
�l	�V�	��U	�^�$��
�'����
���	�	�	���s6�AB/�/C�7C
�	C�
C�C�C�C�C

Zerion Mini Shell 1.0