https://t.me/RX1948
Server : nginx/1.24.0
System : Linux ip-172-31-33-48 6.14.0-1011-aws #11~24.04.1-Ubuntu SMP Fri Aug 1 02:07:25 UTC 2025 x86_64
User : www-data ( 33)
PHP Version : 8.3.6
Disable Function : NONE
Directory :  /lib/python3/dist-packages/cloudinit/config/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : //lib/python3/dist-packages/cloudinit/config/__pycache__/modules.cpython-312.pyc
�

x[hK5��"�ddlZddlZddlmZddlmZddlmZmZm	Z	m
Z
ddlmZm
Z
mZmZmZmZddlmZddlmZddlmZdd	lmZdd
lmZej8e�ZdZgd�Z d
diZ!Gd�de	�Z"d�Z#d�Z$de"de%de&fd�Z'Gd�d�Z(y)�N)�	signature)�
ModuleType)�Dict�List�
NamedTuple�Optional)�config�importer�	lifecycle�performance�
type_utils�util)�ALL_DISTROS)�ConfigMerger)�ReportEventStack)�FREQUENCIES)�Init�cc_)�cc_emit_upstartzcc_refresh_rmc_and_interface.py�cc_migrator�cc_rightscale_userdata�cc_ubuntu_advantage�
cc_ubuntu_proc�<�eZdZUeed<eed<eed<eeed<y)�
ModuleDetails�module�name�	frequency�run_argsN)�__name__�
__module__�__qualname__r�__annotations__�strr���:/usr/lib/python3/dist-packages/cloudinit/config/modules.pyrr4s����

�I��N��3�i�r&rc���|jdd�}|j�jd�r|dt|�dz
}|j	�}|sy|jt�s
t�|��}|S)N�-�_z.pyr�)�replace�lower�endswith�len�strip�
startswith�
MOD_PREFIX)r�
canon_names  r'�form_module_namer4;sp�����c�3�'�J�����"�"�5�)���S��_�q�%8�:�
��!�!�#�J���� � ��,�)�:�6�
��r&c	�"�t|d�rd|jvsd|jvrtd|�d|�d���|jdtvr"td|�d|�d|jd�d���t|d	�rtd|�d|�d
���y)N�metar�distroszModule 'z
' with name 'z4' MUST have a 'meta' attribute of type 'MetaSchema'.z' has an invalid frequency �.�schemazX' has a JSON 'schema' attribute defined. Please define schema in cloud-init-schema,json.)�hasattrr6�
ValueErrorr)�modrs  r'�validate_moduler=Gs����C�� ��c�h�h�&��C�H�H�$���s�e�=���/$�
$�
�	
��x�x���K�/���s�e�=���.I��x�x��$�%�Q�
(�
�	
��s�H����s�e�=���/G�
G�
�	
�r&�module_details�cfg�returnc��t|jjjdi��}|sy|j	|j��syy)N�activate_by_schema_keysTF)�	frozensetrr6�get�intersection�keys)r>r?�activate_by_schema_keys_keyss   r'�
_is_activerH]sL��#,����"�"�&�&�'@�"�E�$� �(��'�4�4�S�X�X�Z�@��r&c��eZdZddefd�Zedejfd��Zde	e
fd�Zde	efd�Z
de	efd	�Zdd
�Zd�Zy)
�ModulesN�initc�\�||_||_d|_|�tddd��}||_y)Nzmodule-reporterzmodule-descF)r�description�reporting_enabled)rK�	cfg_files�_cached_cfgr�reporter)�selfrKrOrQs    r'�__init__zModules.__init__is:����	�"���48�����'�&�)�"'��H�
!��
r&r@c�$�|j�ft|jj|jj|j
|jj��}|j|_tj|j�S)N)�paths�
datasource�additional_fns�base_cfg)	rPrrKrUrVrOr?�copy�deepcopy)rR�mergers  r'r?zModules.cfgvsg�����#�!��i�i�o�o��9�9�/�/�#�~�~������	�F� &�z�z�D���}�}�T�-�-�.�.r&c	��g}||jvr|S|jj|�}|s|S|D�]T}|s�t|t�r"|j	d|j�i��9t|t�rui}t|�dk\r|dj�|d<t|�dk\r|dj�|d<t|�dk\r|dd|d<|s��|j	|���t|t�rei}d	}d
|vr|d
j�|d<d}d|vr|dj�|d<d|vr|dxsg|d<|s��|s�� |j	|���3td
|�dtj|�����|S)aURead the modules from the config file given the specified name.

        Returns a list of module definitions. E.g.,
        [
            {
                "mod": "bootcmd",
                "freq": "always",
                "args": "some_arg",
            }
        ]

        Note that in the default case, only "mod" will be set.
        r<�r��freqr+N�argsFrTrzFailed to read 'z' item in config, unknown type )r?rD�
isinstancer$�appendr0�listr/�dict�	TypeErrorr
�obj_name)rRr�module_list�cfg_mods�item�contents�valids       r'�
_read_moduleszModules._read_modules�s���#%���t�x�x�����8�8�<�<��%������$	�D����$��$��"�"��t�z�z�|���
�D�4�)����t�9��>�&*�1�g�m�m�o�H�U�O��t�9��>�'+�A�w�}�}��H�V�$��t�9��>�'+�A�B�x�H�V�$���&�&�x�0��D�4�)������T�>�&*�6�l�&8�&8�&:�H�U�O� �E��$�&�'+�K�'8�'>�'>�'@�H�V�$��T�>�'+�F�|�'9�r�H�V�$����&�&�x�0���Z�0�0��6�8���C$	�J�r&c	���g}|D�]_}|d}|jd�}|jd�xsg}t|�}|s�=|r'|tvrtjd|�d|��d��d}|t
vr.tjd	|�d
t
|�d�d��t
|}t
j|d
tjt�gdg�\}}	|s;|tvrtjd|dd�ntjd||	���
t
j|d�}
t!|
|�|�|
j"d}|j%t'|
|||�����b|S)z�Convert list of returned from _read_modules() into new format.

        Invalid modules and arguments are ignored.
        Also ensures that the module has the required meta fields.
        r<r_r`zConfig specified module z has an unknown frequency z22.1��
deprecated�deprecated_versionNzModule has been renamed from z to z/. Update any references in /etc/cloud/cloud.cfgz24.1��handlez\Module `%s` has been removed from cloud-init. It may be removed from `/etc/cloud/cloud.cfg`.r+z,Could not find module named %s (searched %s)rr)rrrr)rDr4rr�	deprecate�RENAMED_MODULESr
�find_moduler
rfr	�REMOVED_MODULES�LOG�info�warning�
import_moduler=r6rbr)rR�raw_mods�mostly_mods�raw_mod�raw_namer_r�mod_name�mod_locs�looked_locsr<s           r'�_fixup_moduleszModules._fixup_modules�s������9	�G��u�~�H��;�;�v�&�D��{�{�6�*�0�b�H�'��1�H�����K�/��#�#�2�8�*�=&�&*�V�-�(.�����?�*��#�#�7��z��*�8�4�5�6>�>�(.�
�+�8�4��$,�$8�$8��2�z�2�2�6�:�;�h�Z�%�!�H�k����.��H�H�I� ������K�K�F� �#��
��(�(��!��5�C��C��*��|��x�x��,�������!�"�%�	�
�e9	�t�r&r|c	�|�|jj�}g}g}|D�]7\}}}}	tjd|||�|j	|�d|��}	d|	�d|��}
t|	|
|j��}||j||d�}|5t|j�}
|
j}t|�dk(r.tjdd	�
�|jdti�tj dd
��5}|j#|	|j||��\}}ddd�r|	�dj$d�d�|_n
d|	z|_ddd���:||fS#1swY�=xYw#1swY�xYw#t($r:}t+j,td||�|j	||f�Yd}~���d}~wwxYw)Nz(Running module %s (%s) with frequency %szconfig-zrunning z with frequency )rrM�parent)rr?�cloudr`�z%Config modules with a `log` parameterz23.2rn�logrq�skip)�log_mode)r_z ran successfully and took z.3fz secondsz%s previously ranzRunning module %s (%s) failed)rK�cloudifyrw�debugrbrrQr?rrr�
parametersr/rrs�updater�Timed�run�delta�message�	Exceptionr�logexc)rRr|�cc�failures�	which_ranr<rr_r`�run_name�desc�myrep�	func_args�func_signature�func_params�timer�ran�_r�es                   r'�_run_moduleszModules._run_moduless���
�Y�Y�
�
�
!�����	�%0�.	+�!�C��t�T�-
+��	�	�>��c�4��
� � ��&�$�T�F�+��9A�4�H��(�!�t�D�M�M���!��8�8�� �	�	��G�%.�s�z�z�%:�N�"0�";�";�K��;�'�1�,�!�+�+�'N�/5��"�(�(�%���6�$�*�*�2��?��5�"$�&�&�$�c�j�j�)�$�#)�#���R���'�j�)$�$)�K�K��#4�H�>��
�
)<�h�(F��
�)G��-.	+�^�8�$�$����G�G��,�
+����C�!@�$��L�����q�	�*�*��
+�sI�A!E8�A5E,�#E �$-E,�E8� E)�%E,�,E5	�1E8�8	F;�/F6�6F;c�X�|||d�}|g}|j|�}|j|�S)N)r<r`r_)r�r�)rRrr`r_�	mod_to_ber{r|s       r'�
run_singlezModules.run_single9s>�����
�	��;���)�)�(�3��� � ��-�-r&c��|j|�}|j|�}|jjj}g}g}|j
j
dg�}g}g}	|D]�}
|
\}}}
}|��
|jd}t|
|j
�s|j|��D|r5|tgk7r+||vr'||vr|j|��j|j|�|	j|||
|g���|r%tjddj|��|r&tjddj|�|�|r%tjddj|��|j|	�S)z�Runs all modules in the given section.

        section_name - One of the modules lists as defined in
          /etc/cloud/cloud.cfg. One of:
         - cloud_init_modules
         - cloud_config_modules
         - cloud_final_modules
        �unverified_modulesr7z?Skipping modules '%s' because no applicable config is provided.�,zSkipping modules '%s' because they are not verified on distro '%s'.  To run anyway, add them to 'unverified_modules' in config.z running unverified_modules: '%s'z, )rlr�rK�distrorr?rDr6rHrbrrwrx�joinr�)rR�section_namer{r|�distro_name�skipped�forced�
overridden�inapplicable_mods�active_modsr>r<r�_freq�_args�worked_distross                r'�run_sectionzModules.run_sectionEs}���%�%�l�3���)�)�(�3���i�i�&�&�+�+�������X�X�\�\�"6��;�
�����)�	:�N�(6�%�S�$��u��{�� �X�X�i�0�N��n�d�h�h�7�!�(�(��.���.�[�M�"A��n�4��:�-����t�,� ��M�M�$�'�����T�5�%�8�9�'	:�*��H�H�����*�+�
�
��H�H�2�����!��
���H�H�7����6�9J�K�� � ��-�-r&)NN)r r!r"rrS�propertyr	�Configr?rrrlrr�r�r�r�r%r&r'rJrJhsn��!�T�!��/�V�]�]�/��/�9�T�$�Z�9�vA�$�}�*=�A�F5%��]�(;�5%�n
.�8.r&rJ))rY�logging�inspectr�typesr�typingrrrr�	cloudinitr	r
rrr
r�cloudinit.distrosr�cloudinit.helpersr�cloudinit.reporting.eventsr�cloudinit.settingsr�cloudinit.stagesr�	getLoggerr rwr2rvrtrr4r=rd�boolrHrJr%r&r'�<module>r�s�������3�3���*�*�7�*�!��g����!���
�
���?���
�J��	�
�,�}��4��D��U.�U.r&

https://t.me/RX1948 - 2025