HOME


Mini Shell 1.0
Redirecting to https://devs.lapieza.net/iniciar-sesion Redirecting to https://devs.lapieza.net/iniciar-sesion.
DIR: /proc/self/root/usr/lib/python3/dist-packages/cloudinit/config/__pycache__/
Upload File :
Current File : //proc/self/root/usr/lib/python3/dist-packages/cloudinit/config/__pycache__/modules.cpython-311.pyc
�

܍~c�-���ddlZddlmZddlmZmZmZmZddlm	Z	m
Z
ddlmZddlm
Z
mZddlmZddlmZdd	lmZdd
lmZddlmZeje��ZdZGd
�de��Zd�Zd�Zdede de!fd�Z"Gd�d��Z#dS)�N)�
ModuleType)�Dict�List�
NamedTuple�Optional)�config�importer)�log)�
type_utils�util)�ALL_DISTROS)�ConfigMerger)�ReportEventStack)�FREQUENCIES)�Init�cc_c�D�eZdZUeed<eed<eed<eeed<dS)�
ModuleDetails�module�name�	frequency�run_argsN)�__name__�
__module__�__qualname__r�__annotations__�strr���:/usr/lib/python3/dist-packages/cloudinit/config/modules.pyrrs@�����������

�I�I�I��N�N�N��3�i�����rrc�.�|�dd��}|����d��r|dt|��dz
�}|���}|sdS|�t��st�|��}|S)N�-�_z.pyr�)�replace�lower�endswith�len�strip�
startswith�
MOD_PREFIX)r�
canon_names  r �form_module_namer-&s������c�3�'�'�J������"�"�5�)�)�;���S��_�_�q�%8� 9�:�
��!�!�#�#�J����t�� � ��,�,�7�)�z�:�:�6�
��rc	�2�t|d��rd|jvs	d|jvrtd|�d|�d����|jdtvr$td|�d|�d|jd�d����t|d	��rtd|�d|�d
����dS)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.)�hasattrr/�
ValueErrorr)�modrs  r �validate_moduler62s���C�� � �
��c�h�&�&��C�H�$�$��
$�s�
$�
$��
$�
$�
$�
�
�	
��x���K�/�/��
(�s�
(�
(��
(�
(��x��$�
(�
(�
(�
�
�	
��s�H���
��
G�s�
G�
G��
G�
G�
G�
�
�	
�
�
r�module_details�cfg�returnc��t|jj�di����}|sdS|�|�����sdSdS)N�activate_by_schema_keysTF)�	frozensetrr/�get�intersection�keys)r7r8�activate_by_schema_keys_keyss   r �
_is_activerAHsc��#,���"�&�&�'@�"�E�E�$�$� �(���t�'�4�4�S�X�X�Z�Z�@�@���u��4rc��eZdZddefd�Zedejfd���Zde	e
fd�Zde	efd�Z
de	efd	�Zdd
�Zd�ZdS)
�ModulesN�initc�f�||_||_d|_|�tddd���}||_dS)Nzmodule-reporterzmodule-descF)r�description�reporting_enabled)rD�	cfg_files�_cached_cfgr�reporter)�selfrDrHrJs    r �__init__zModules.__init__TsH����	�"���48�����'�&�)�"'����H�
!��
�
�
rr9c���|j�Bt|jj|jj|j|jj���}|j|_tj|j��S)N)�paths�
datasource�additional_fns�base_cfg)	rIrrDrNrOrHr8�copy�deepcopy)rK�mergers  r r8zModules.cfgas[����#�!��i�o��9�/�#�~����	���F� &�z�D���}�T�-�.�.�.rc	��g}||jvr|S|j�|��}|s|S|D�]�}|s�t|t��r*|�d|���i���Et|t��r�i}t|��dkr|d���|d<t|��dkr|d���|d<t|��dkr
|dd�|d<|r|�|����t|t��rti}d	}d
|vr|d
���|d<d}d|vr|d���|d<d|vr
|dpg|d<|r|r|�|����}td
|�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.
        r5�r��freqr$N�argsFrTrzFailed to read 'z' item in config, unknown type )r8r=�
isinstancer�appendr)�listr(�dict�	TypeErrorr�obj_name)rKr�module_list�cfg_mods�item�contents�valids       r �
_read_moduleszModules._read_modulesos��#%���t�x������8�<�<��%�%���	����$	�$	�D��
���$��$�$�!
��"�"��t�z�z�|�|������
�D�4�)�)�
����t�9�9��>�>�&*�1�g�m�m�o�o�H�U�O��t�9�9��>�>�'+�A�w�}�}���H�V�$��t�9�9��>�>�'+�A�B�B�x�H�V�$��1��&�&�x�0�0�0���D�4�)�)�
������T�>�>�&*�6�l�&8�&8�&:�&:�H�U�O� �E��$�&�&�'+�K�'8�'>�'>�'@�'@�H�V�$��T�>�>�'+�F�|�'9�r�H�V�$��1��1��&�&�x�0�0�0���i��t�t�Z�0��6�6�6�8�����rc	�X�g}|D�]#}|d}|�d��}|�d��pg}t|��}|s�I|r'|tvrt�d||��d}tj|dtjt��gdg��\}}	|st�d||	����tj
|d	��}
t|
|��|�
|
jd
}|�
t|
|||�������%|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.
        r5rXrYz6Config specified module %s has an unknown frequency %sN��handlez,Could not find module named %s (searched %s)rr)rrrr)r=r-r�LOG�warningr	�find_modulerr_r�
import_moduler6r/r[r)rK�raw_mods�mostly_mods�raw_mod�raw_namerXr�mod_name�mod_locs�looked_locsr5s           r �_fixup_moduleszModules._fixup_modules�sn�����&	�&	�G��u�~�H��;�;�v�&�&�D��{�{�6�*�*�0�b�H�'��1�1�H��
���
��K�/�/����L��������$,�$8��2�z�2�6�:�:�;�h�Z�%�%�!�H�k��
����B������
��(��!��5�5�C��C��*�*�*��|��x��,�������!�"�%�	���
�
�
�
��rrnc�d�|j���}g}g}|D�]\}}}}	t�d|||��||j|t|g}	|�|��d|��}
d|
�d|��}t
|
||j���}|5|�|
|j	|	|���\}
}|
rd|
z|_
n
d|
z|_
ddd��n#1swxYwY��#t$r>}tj
td	||��|�||f��Yd}~��d}~wwxYw||fS)
Nz(Running module %s (%s) with frequency %szconfig-zrunning z with frequency )rrF�parent)rXz%s ran successfullyz%s previously ranzRunning module %s (%s) failed)rD�cloudifyri�debugr8r[rrJ�runrh�message�	Exceptionr�logexc)rKrn�cc�failures�	which_ranr5rrXrY�	func_args�run_name�desc�myrep�ran�_r�es                r �_run_moduleszModules._run_modules�s���
�Y�
�
�
!�
!�����	�'2� 	+� 	+�#�S�$��d�
+��	�	�>��c�4����"�4�8�R��d�;�	�� � ��&�&�&�+�T�+�+���9A���4�4�H��(�!�t�D�M������G�G� �f�f� �#�*�i�d�%���G�C���G�(=��(H��
�
�(;�h�(F��
�G�G�G�G�G�G�G�G�G�G�G����G�G�G�G����
+�
+�
+���C�!@�$��L�L�L�����q�	�*�*�*�*�*�*�*�*�����
+�����8�$�$s<�A)C#�9C�C#�C	�C#�C	�C#�#
D+�-3D&�&D+c�h�|||d�}|g}|�|��}|�|��S)N)r5rYrX)rtr�)rKrqrYrX�	mod_to_bermrns       r �
run_singlezModules.run_singlesI�����
�
�	��;���)�)�(�3�3��� � ��-�-�-rc�L�|�|��}|�|��}|jjj}g}g}|j�dg��}g}g}	|D]�}
|
\}}}
}|��|jd}t|
|j��s|�	|���D|r?|tgkr3||vr/||vr|�	|���p|�	|��|	�	|||
|g����|r.t�dd�
|����|r/t�dd�
|��|��|r.t�dd�
|����|�|	��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_modulesNr0z?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, )rertrD�distrorr8r=r/rAr[r
ri�info�joinr�)rK�section_namermrn�distro_name�skipped�forced�
overridden�inapplicable_mods�active_modsr7r5r�_freq�_args�worked_distross                r �run_sectionzModules.run_sections����%�%�l�3�3���)�)�(�3�3���i�&�+�������X�\�\�"6��;�;�
�����)�	:�	:�N�(6�%�S�$��u��{�� �X�i�0�N��n�d�h�7�7�
�!�(�(��.�.�.���
(�.�[�M�"A�"A��n�4�4��:�-�-����t�,�,�,� ��M�M�$�'�'�'�����T�5�%�8�9�9�9�9��	��H�H�����*�+�+�
�
�
�
�	��H�H�2�����!�!��
�
�
��	L��H�H�7����6�9J�9J�K�K�K�� � ��-�-�-r)NN)rrrrrL�propertyr�Configr8rrrerrtr�r�r�rrr rCrCSs�������!�!�T�!�!�!�!��/�V�]�/�/�/��X�/�9�T�$�Z�9�9�9�9�v.�$�}�*=�.�.�.�.�`'%��]�(;�'%�'%�'%�'%�R
.�
.�
.�
.�8.�8.�8.�8.�8.rrC)$rR�typesr�typingrrrr�	cloudinitrr	r
�loggingrr�cloudinit.distrosr
�cloudinit.helpersr�cloudinit.reporting.eventsr�cloudinit.settingsr�cloudinit.stagesr�	getLoggerrrir+rr-r6r]�boolrArCrrr �<module>r�s�������������3�3�3�3�3�3�3�3�3�3�3�3�&�&�&�&�&�&�&�&�$�$�$�$�$�$�&�&�&�&�&�&�&�&�)�)�)�)�)�)�*�*�*�*�*�*�7�7�7�7�7�7�*�*�*�*�*�*�!�!�!�!�!�!��g���!�!���
������J����	�	�	�
�
�
�,�}��4��D�����t.�t.�t.�t.�t.�t.�t.�t.�t.�t.r