Spamworldpro Mini Shell
Spamworldpro


Server : Apache/2.4.52 (Ubuntu)
System : Linux webserver 6.8.0-49-generic #49~22.04.1-Ubuntu SMP PREEMPT_DYNAMIC Wed Nov 6 17:42:15 UTC 2 x86_64
User : www-data ( 33)
PHP Version : 8.1.2-1ubuntu2.21
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-310.pyc
o

}��f�3�@s�ddlZddlZddlmZddlmZddlmZmZm	Z	m
Z
ddlmZm
Z
mZmZddlmZddlmZddlmZdd	lmZdd
lmZe�e�ZdZdd
gZddiZGdd�de	�Z dd�Z!dd�Z"de de#de$fdd�Z%Gdd�d�Z&dS)�N)�	signature)�
ModuleType)�Dict�List�
NamedTuple�Optional)�config�importer�
type_utils�util)�ALL_DISTROS)�ConfigMerger)�ReportEventStack)�FREQUENCIES)�Init�cc_�cc_migrator�cc_rightscale_userdata�cc_ubuntu_advantage�
cc_ubuntu_proc@s2eZdZUeed<eed<eed<eeed<dS)�
ModuleDetails�module�name�	frequency�run_argsN)�__name__�
__module__�__qualname__r�__annotations__�strr�r r �:/usr/lib/python3/dist-packages/cloudinit/config/modules.pyr+s

rcCsX|�dd�}|���d�r|dt|�d�}|��}|sdS|�t�s*dt|f}|S)N�-�_z.pyr�z%s%s)�replace�lower�endswith�len�strip�
startswith�
MOD_PREFIX)r�
canon_namer r r!�form_module_name2s
r-cCs�t|d�rd|jvsd|jvrtd|�d|�d���|jdtvr2td|�d|�d|jd�d���t|d	�rBtd|�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)�modrr r r!�validate_module>s$�

���
��r5�module_details�cfg�returncCs2t|jj�di��}|sdS|�|���sdSdS)N�activate_by_schema_keysTF)�	frozensetrr.�get�intersection�keys)r6r7�activate_by_schema_keys_keysr r r!�
_is_activeTs�r?c@sxeZdZddefdd�Zedejfdd��Zde	e
fdd	�Zde	efd
d�Z
de	efd
d�Zddd�Zdd�ZdS)�ModulesN�initcCs2||_||_d|_|durtdddd�}||_dS)Nzmodule-reporterzmodule-descF)r�description�reporting_enabled)rA�	cfg_files�_cached_cfgr�reporter)�selfrArDrFr r r!�__init__`s�
zModules.__init__r8cCs<|jdurt|jj|jj|j|jjd�}|j|_t�|j�S)N)�paths�
datasource�additional_fns�base_cfg)	rEr
rArIrJrDr7�copy�deepcopy)rG�mergerr r r!r7ms
�zModules.cfgcCsPg}||jvr	|S|j�|�}|s|S|D]�}|sqt|t�r)|�d|��i�qt|t�rbi}t|�dkr>|d��|d<t|�dkrL|d��|d<t|�dkrZ|dd�|d<|ra|�|�qt|t�r�i}d	}d
|vry|d
��|d<d}d|vr�|d��|d<d|vr�|dp�g|d<|r�|r�|�|�qt	d
|t
�|�f��|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.
        r4�r��freqr$N�argsFrTrz3Failed to read '%s' item in config, unknown type %s)r7r;�
isinstancer�appendr)�listr(�dict�	TypeErrorr
�obj_name)rGr�module_list�cfg_mods�item�contents�validr r r!�
_read_modules{sX

��

�

���zModules._read_modulesc	Cs*g}|D]�}|d}|�d�}|�d�pg}t|�}|sq|r2|tvr2tjd|�d|��dd�d}|tvrJtjd	|�d
t|�d�dd�t|}t�|d
t�	t
�gdg�\}}	|sr|tvrjt�
d|dd��nt�d||	�qt�|d�}
t|
|�|dur�|
jd}|�t|
|||d��q|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.
        r4rRrSzConfig 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)r;r-rr�	deprecate�RENAMED_MODULESr	�find_moduler
rYr�REMOVED_MODULES�LOG�info�warning�
import_moduler5r.rUr)rG�raw_mods�mostly_mods�raw_mod�raw_namerRr�mod_name�mod_locs�looked_locsr4r r r!�_fixup_modules�sh
��	���
��

��zModules._fixup_modulesrncCsP|j��}g}g}|D]�\}}}}zqt�d|||�|�|�d|��}	d|	|f}
t|	|
|jd�}||j||d�}|�=t|j	�}
|
j
}t|�dkrYtj
ddd	�|�d
ti�|j|	|j	||d�\}}|rmd|	|_nd
|	|_Wd�n1s|wYWqty�}zt�td||�|�||f�WYd}~qd}~ww||fS)Nz(Running module %s (%s) with frequency %szconfig-zrunning %s with frequency %s)rrB�parent)rr7�cloudrS�z%Config modules with a `log` parameterz23.2r`�log)rRz%s ran successfullyz%s previously ranzRunning module %s (%s) failed)rA�cloudifyri�debugrUrrFr7rrd�
parametersr(rre�update�run�message�	Exception�logexc)rGrn�cc�failures�	which_ranr4rrRrS�run_name�desc�myrep�	func_args�func_signature�func_params�ran�_r�er r r!�_run_modules�sV
�

��
�

�
�����zModules._run_modulescCs&|||d�}|g}|�|�}|�|�S)N)r4rSrR)rtr�)rGrqrSrR�	mod_to_bermrnr r r!�
run_single+s�

zModules.run_singlecCs|�|�}|�|�}|jjj}g}g}|j�dg�}g}g}	|D]A}
|
\}}}
}|dur-q |jd}t|
|j�s>|�	|�q |rX|t
gkrX||vrX||vrS|�	|�q |�	|�|	�	|||
|g�q |rmt�dd�
|��|ryt�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_modulesNr/z?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, )r_rtrA�distrorr7r;r.r?rUrrirj�joinr�)rG�section_namermrn�distro_name�skipped�forced�
overridden�inapplicable_mods�active_modsr6r4r�_freq�_args�worked_distrosr r r!�run_section7sJ
	





��
zModules.run_section)NN)rrrrrH�propertyr�Configr7rrr_rrtr�r�r�r r r r!r@_s

;C
2r@)'rM�logging�inspectr�typesr�typingrrrr�	cloudinitrr	r
r�cloudinit.distrosr�cloudinit.helpersr
�cloudinit.reporting.eventsr�cloudinit.settingsr�cloudinit.stagesr�	getLoggerrrir+rhrfrr-r5rW�boolr?r@r r r r!�<module>s.
��

Spamworldpro Mini