403Webshell
Server IP : 3.96.16.70  /  Your IP : 216.73.216.15
Web Server : Apache
System : Linux ip-172-31-26-103.ca-central-1.compute.internal 6.1.163-186.299.amzn2023.x86_64 #1 SMP PREEMPT_DYNAMIC Tue Feb 24 16:35:42 UTC 2026 x86_64
User : ec2-user ( 1000)
PHP Version : 8.4.18
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : OFF  |  Sudo : ON  |  Pkexec : OFF
Directory :  /lib/python3.9/site-packages/cloudinit/config/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /lib/python3.9/site-packages/cloudinit/config/__pycache__/modules.cpython-39.pyc
a

�½bL*�@s�ddlZddlmZddlmZddlmZmZddlmZ	ddlm
Z
mZddlm
Z
ddlmZdd	lmZdd
lmZddlmZe	�e�ZdZed
gd��Zdd�Zdd�ZGdd�de�ZdS)�N)�
namedtuple)�List)�config�importer)�log)�
type_utils�util)�ALL_DISTROS)�ConfigMerger)�ReportEventStack)�FREQUENCIES)�InitZcc_�
ModuleDetails��module�name�	frequency�run_argscCsX|�dd�}|���d�r.|dt|�d�}|��}|s>dS|�t�sTdt|f}|S)N�-�_z.pyr�z%s%s)�replace�lower�endswith�len�strip�
startswith�
MOD_PREFIX)rZ
canon_name�r�</usr/lib/python3.9/site-packages/cloudinit/config/modules.py�form_module_name"s
r cCs�t|d�rd|jvsd|jvr4td|�d|�d���|jdtvrdtd|�d|�d|jd�d���t|d	�r�td|�d|�d
���dS)N�metar�distroszModule 'z
' with name 'z4' MUST have a 'meta' attribute of type 'MetaSchema'.z' has an invalid frequency �.ZschemazX' has a JSON 'schema' attribute defined. Please define schema in cloud-init-schema,json.)�hasattrr!�
ValueErrorr)�modrrrr�validate_module.s&������
�r'c@sfeZdZded�dd�Zedd��Zdd�Zee	d	�d
d�Z
ee	d�d
d�Zddd�Zdd�Z
dS)�ModulesN)�initcCs2||_||_d|_|dur(tdddd�}||_dS)Nzmodule-reporterzmodule-descF)r�descriptionZreporting_enabled)r)�	cfg_files�_cached_cfgr�reporter)�selfr)r+r-rrr�__init__Es�zModules.__init__cCs<|jdur0t|jj|jj|j|jjd�}|j|_t�|j�S)N)�paths�
datasourceZadditional_fnsZbase_cfg)	r,r
r)r0r1r+�cfg�copyZdeepcopy)r.Zmergerrrrr2Rs
�zModules.cfgcCs`g}||jvr|S|j�|�}|s&|S|D�].}|s6q*t|t�rT|�d|��i�q*t|t�r�i}t|�dkr~|d��|d<t|�dkr�|d��|d<t|�dkr�|dd�|d<|r�|�|�q*t|t��rDi}d	}d
|vr�|d
��|d<d}d|v�r|d��|d<d|v�r,|d�p&g|d<|�rZ|�rZ|�|�q*t	d
|t
�|�f��q*|S)aTRead 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��freqrN�argsFrTrz3Failed to read '%s' item in config, unknown type %s)r2�get�
isinstance�str�appendr�listr�dict�	TypeErrorr�obj_name)r.rZmodule_listZcfg_mods�item�contentsZvalidrrr�
_read_modules`sT


��


��zModules._read_modules)�returnc	Cs�g}|D]�}|d}|�d�}|�d�p*g}t|�}|s:q|rX|tvrXt�d||�d}t�|dt�t	�gdg�\}}	|s�t�d||	�qt�
|d	�}
t|
|�|dur�|
jd
}|�
t|
|||d��q|S)z�Convert list of returned from _read_modules() into new format.

        Invalid modules and arguments are ingnored.
        Also ensures that the module has the required meta fields.
        r&r6r7z6Config specified module %s has an unknown frequency %sN��handlez,Could not find module named %s (searched %s)rrr)r8r r�LOGZwarningr�find_modulerr?r�
import_moduler'r!r;r)r.�raw_mods�mostly_modsZraw_modZraw_namer6r�mod_nameZmod_locsZlooked_locsr&rrr�_fixup_modules�sL
���

��zModules._fixup_modules)rJcCs|j��}g}g}|D]�\}}}}z�t�d|||�||j|t|g}	|�|�d|��}
d|
|f}t|
||jd�}|�B|j|
|j	|	|d�\}
}|
r�d|
|_
n
d|
|_
Wd�n1s�0YWqt�y}z*t�
td||�|�||f�WYd}~qd}~00q||fS)	Nz(Running module %s (%s) with frequency %szconfig-zrunning %s with frequency %s)rr*�parent)r6z%s ran successfullyz%s previously ranzRunning module %s (%s) failed)r)ZcloudifyrF�debugr2r;rr-�runrE�message�	ExceptionrZlogexc)r.rJZccZfailuresZ	which_ranr&rr6r7Z	func_argsZrun_nameZdescZmyrepZranZ_r�errr�_run_modules�s4
�

�
�
,&zModules._run_modulescCs&|||d�}|g}|�|�}|�|�S)N)r&r7r6)rLrS)r.rKr7r6Z	mod_to_berIrJrrr�
run_single�s�
zModules.run_singlecCs�|�|�}|�|�}|jjj}g}g}|j�dg�}g}|D]f\}	}
}}|	durRq<|	jd}
|
r�|
tgkr�||
vr�|
|vr�|�	|
�q<|�	|
�|�	|	|
||g�q<|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
        Zunverified_modulesNr"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, )rBrLr)Zdistrorr2r8r!r	r;rF�info�joinrS)r.Zsection_namerIrJZdistro_nameZskippedZforcedZ
overriddenZactive_modsr&rZ_freqZ_argsZworked_distrosrrr�run_sections6	





�zModules.run_section)NN)NN)�__name__�
__module__�__qualname__r
r/�propertyr2rBrrrLrSrTrXrrrrr(Ds


;0)
r()r3�collectionsr�typingrZ	cloudinitrrrZloggingrrZcloudinit.distrosr	Zcloudinit.helpersr
Zcloudinit.reporting.eventsrZcloudinit.settingsrZcloudinit.stagesr
Z	getLoggerrYrFrrr r'�objectr(rrrr�<module>	s$
�

Youez - 2016 - github.com/yon3zu
LinuXploit