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/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : //lib/python3/dist-packages/cloudinit/__pycache__/helpers.cpython-310.pyc
o

}��fq@�@sddlZddlZddlZddlmZmZmZddlmZddl	m	Z	ddl
mZmZm
Z
mZddlmZmZmZmZe�e�ZGdd�de�ZGd	d
�d
�ZGdd�d�ZGd
d�d�Zdd�ZGdd�d�ZGdd�d�ZGdd�d�ZGdd�d�Z Gdd�dej!�Z"Gdd�de�Z#dS)�N)�
NoOptionError�NoSectionError�RawConfigParser)�StringIO)�time)�persistence�settings�
type_utils�util)�CFG_ENV_NAME�
PER_ALWAYS�PER_INSTANCE�PER_ONCEc@�eZdZdS)�LockFailureN��__name__�
__module__�__qualname__�rr�3/usr/lib/python3/dist-packages/cloudinit/helpers.pyr�rc@r)�	DummyLockNrrrrrrrrc@s4eZdZdd�Zejddd��Zdd�Zdd	�Zd
S)�DummySemaphorescCsdS�Nr��selfrrr�__init__!�zDummySemaphores.__init__Fccs�t�VdSr)r)r�_name�_freq�_clear_on_failrrr�lock$s�zDummySemaphores.lockcC�dS�NFr�rrr rrr�has_run(rzDummySemaphores.has_runcCr#)NTrr%rrr�clear+rzDummySemaphores.clearN�F)	rrrr�
contextlib�contextmanagerr"r&r'rrrrr src@seZdZdd�Zdd�ZdS)�FileLockcC�
||_dSr)�fn)rr-rrrr0�
zFileLock.__init__cCsdt�|�|jfS)Nz<%s using file %r>)r	�obj_namer-rrrr�__str__3szFileLock.__str__N)rrrrr0rrrrr+/sr+cCs|�dd�S)N�-�_)�replace)�namerrr�canon_sem_name7sr5c@sDeZdZdd�Zejddd��Zdd�Zdd	�Zd
d�Z	dd
�Z
dS)�FileSemaphorescCr,r)�sem_path)rr7rrrr<r.zFileSemaphores.__init__Fccs@�t|�}z
|�||�VWdSty|r|�||��wr)r5�_acquire�	Exceptionr')rr4�freq�
clear_on_failrrrr"?s��zFileSemaphores.lockc	CsLt|�}|�||�}zt�|�WdSttfy%t�td|�YdSw)NzFailed deleting semaphore %sFT)r5�	_get_pathr
�del_file�IOError�OSError�logexc�LOG)rr4r:�sem_filerrrr'Is��zFileSemaphores.clearc	Csl|�||�rdS|�||�}dt��t�f}zt�||�Wt|�Sttfy5t�	t
d|�YdSw)Nz%s: %s
z Failed writing semaphore file %s)r&r<�os�getpidrr
�
write_filer>r?r@rAr+)rr4r:rB�contentsrrrr8Ss��zFileSemaphores._acquirecCs0|r|tkrdSt|�}|�||�}tj�|�Sr$)rr5r<rC�path�exists)rr4r:�cnamerBrrrr&cs
zFileSemaphores.has_runcCs6|j}|r	|tkrtj�||�Stj�|d||f�S)Nz%s.%s)r7r
rCrG�join)rr4r:r7rrrr<mszFileSemaphores._get_pathNr()rrrrr)r*r"r'r8r&r<rrrrr6;s	

r6c@s&eZdZdd�Zdd�Zd	dd�ZdS)
�RunnerscCs||_i|_dSr)�paths�sems)rrLrrrrv�
zRunners.__init__cCsh|tks|sdSd}|tkr|j�d�}n
|tkr|j�d�}|s#dS||jvr/t|�|j|<|j|S)N�sem)rr
rL�	get_ipathr�	get_cpathrMr6)rr:r7rrr�_get_semzs

zRunners._get_semNFc	Cs�|�|�}|s
t�}|sg}|�||�rt�d||�dS|�|||��,}|s-td|��t�d||�t|t�rA|di|��}n||�}d|fWd�S1sSwYdS)Nz%s already ran (freq=%s))FNzFailed to acquire lock for %szRunning %s using lock (%s)Tr)	rRrr&rA�debugr"r�
isinstance�dict)	rr4�functor�argsr:r;rO�lk�resultsrrr�run�s"

$�zRunners.runr$)rrrrrRrZrrrrrKusrKc@sReZdZ					ddd�Zdd�Zdd�Zd	d
�Zdefdd
�Ze	dd��Z
dS)�ConfigMergerNTcCs(||_||_||_||_||_d|_dSr)�_paths�_ds�_fns�	_base_cfg�_include_vendor�_cfg)rrL�
datasource�additional_fns�base_cfg�include_vendorrrrr�s
zConfigMerger.__init__cCshg}|jr2z|j��}|rt|t�r|�|�W|SW|SW|Sty1t�td|j�Y|Sw|S)Nz2Failed loading of datasource config object from %s)	r]�get_config_objrTrU�appendr9r
r@rA)r�d_cfgs�ds_cfgrrr�_get_datasource_configs�s(
�����z$ConfigMerger._get_datasource_configscCsVg}ttjvr)tjt}z|�t�|��W|Sty(t�td|�Y|Sw|S)Nz%Failed loading of env. config from %s)	rrC�environrgr
�	read_confr9r@rA)r�e_cfgs�e_fnrrr�_get_env_configs�s

��zConfigMerger._get_env_configsc	Cs�g}|js|Sdg}|jr|�d�|�d�|D]9}|j�|�}|rRtj�|�rRz
|�t�|��Wqt	yBt
�d|�YqtyQt�
t
d|�Yqwq|S)N�cloud_config�vendor2_cloud_config�vendor_cloud_configz5Skipped loading cloud-config from %s due to non-root.z&Failed loading of cloud-config from %s)r\r`rg�
get_ipath_currCrG�isfiler
rl�PermissionErrorrArSr9r@)r�i_cfgs�cc_paths�cc_p�cc_fnrrr�_get_instance_configs�s0

����z"ConfigMerger._get_instance_configs�returnc	Cs�g}|jr%|jD]}z
|�t�|��Wqty$t�td|�Yqw|�|���|�|�	��|�|�
��|jrC|�|j�t�|�S)Nz'Failed loading of configuration from %s)
r^rgr
rlr9r@rA�extendrorzrjr_�
mergemanydict)r�cfgs�c_fnrrr�	_read_cfg�s 
��
zConfigMerger._read_cfgcCs|jdur
|��|_|jSr)rar�rrrr�cfgs

zConfigMerger.cfg)NNNNT)rrrrrjrorzrUr��propertyr�rrrrr[�s
�
 r[c@sFeZdZdd�Zdd�Zdd�Zdd�Zddd�Zd
d�Zdd�Z	dS)�ContentHandlerscCsi|_g|_dSr)�
registered�initializedrrrrr
rNzContentHandlers.__init__cC�
|�|�Sr)�
is_registered)r�itemrrr�__contains__r.zContentHandlers.__contains__cCr�r)�_get_handler)r�keyrrr�__getitem__r.zContentHandlers.__getitem__cCs
||jvSr�r��r�content_typerrrr�r.zContentHandlers.is_registeredFTcCsjt�}|��D]}|r|�|�q|�|�s|�|�q|D]}||j|<q|r3||jvr3|j�|�|Sr)�set�
list_types�addr�r�r�rg)r�modr��	overwrite�types�trrr�registers

�zContentHandlers.registercCs
|j|Srr�r�rrrr�(r.zContentHandlers._get_handlercCst|j���Sr)�listr��itemsrrrrr�+�zContentHandlers.itemsN)FT)
rrrrr�r�r�r�r�r�rrrrr�s
r�c@steZdZdZddefdd�Zdeddfdd	�Zdd
d�Zddd
�Z	ddd�Z
ddd�Zddefdd�Z
ddd�ZdS)�Paths�N�	path_cfgsc	Cs||_|�dd�|_|�dd�|_|�dtj�|_tj�	|jd�|_
tj�	|j
d�|_tj�	|jd�|_|�d	d
�}tj�	|d�|_
idd�d
d�dd�dd�dd�dd�dd�dd�dd�dd�dd�dd�d d �d!d"�d#d$�d%d&�d'd(�d)d*d+d,d-d.d/d0��|_||_dS)1N�	cloud_dirz/var/lib/cloud�docs_dirz/usr/share/doc/cloud-init/�run_dir�instancez
boot-finished�seed�
templates_dirz/etc/cloud/templates/z%s.tmpl�	boothooksrpzcloud-config.txt�data�handlers�
instance_data�instance-data.json�instance_data_sensitive�instance-data-sensitive.json�combined_cloud_config�combined-cloud-config.json�network_configznetwork-config.json�instance_idz.instance-id�manual_clean_markerzmanual-clean�obj_pklzobj.pkl�scriptsrO�userdatazuser-data.txt.i�userdata_rawz
user-data.txt�
vendordatazvendor-data.txt.i�vendordata2zvendor-data2.txt.izvendor-data2.txtzvendor-data.txtzvendor2-cloud-config.txtzvendor-cloud-config.txtzscripts/vendor�warnings�hotplug.enabled)�vendordata2_raw�vendordata_rawrqrr�vendor_scriptsr�r�)r~�getr�r�r�DEFAULT_RUN_DIRr�rCrGrJ�
instance_link�
boot_finished�seed_dir�template_tpl�lookupsrb)rr��ds�template_dirrrrr2sv����������
����������
�
 zPaths.__init__�ci_pkl_versionr{cCsvt|d�st|j|jd�j|_d|jvrd|jd<d|jvr#d|jd<d|jvr-d|jd<d	|jvr9d	|jd	<d
Sd
S)z(Perform deserialization fixes for Paths.r�)r�r�r�r�r�r�r�r�r�N)�hasattrr�r~rbr�r�)rr�rrr�	_unpicklefs*
��


��
��
�zPaths._unpicklecC�|�|j|�Sr)r<r��rr4rrrrsr�zPaths.get_ipath_curcCr�r)r<r�r�rrrrQ�r�zPaths.get_cpathcCsf|jsdS|j��}|durdSt|��tjd�}tj�|jd|�}|j	�
|�}|r1tj�||�}|S)Nr2�	instances)rb�get_instance_id�strr3rC�seprGrJr�r�r�)rr4�iid�
path_safe_iid�ipath�add_onrrr�
_get_ipath�s
zPaths._get_ipathcCs |�|�}|st�d�dS|S)Nz?No per instance data available, is there an datasource/iid set?)r�rA�warning)rr4r�rrrrP�s
�zPaths.get_ipath�basecCs |dur|Stj�||j|�Sr)rCrGrJr�)rr�r4rrrr<�szPaths._get_pathcCr�r)r<r�r�rrr�get_runpath�r�zPaths.get_runpathr)rrr�_ci_pkl_versionrUr�intr�rsrQr�rPr�r<r�rrrrr�/s4



r�c@sXeZdZdZdZdZdZdd�Zddd�Zd	d
�Z	dd�Z
d
d�Zdd�Zddd�Z
dS)�DefaultingConfigParserrgFNcCsB|j}z
t�|||�}W|StyY|Sty Y|Swr)�DEF_BASErr�rr�r�section�option�valuerrrr��s���zDefaultingConfigParser.getcCs4|�|�s|��dkr|�|�t�||||�dS)N�default)�has_section�lower�add_sectionrr�r�rrrr��s
zDefaultingConfigParser.setcCs"|�||�rt�|||�dSdSr)�
has_optionr�
remove_option�rr�r�rrrr��s�z$DefaultingConfigParser.remove_optioncC� |�||�s	|jSt�|||�Sr)r��DEF_BOOLEANr�
getbooleanr�rrrr���z!DefaultingConfigParser.getbooleancCr�r)r��	DEF_FLOATr�getfloatr�rrrr��r�zDefaultingConfigParser.getfloatcCr�r)r��DEF_INTr�getintr�rrrr��r�zDefaultingConfigParser.getintcCs<d}t�}|�|�|��|��}|rd�||dg�}|S)N��
)r�write�flush�getvaluerJ)r�headerrF�outputstreamrrr�	stringify�s
z DefaultingConfigParser.stringifyr)rrrr�r�r�r�r�r�r�r�r�r�r�rrrrr��s

r�)$r)�loggingrC�configparserrrr�iorr�	cloudinitrrr	r
�cloudinit.settingsrrr
r�	getLoggerrrAr9rrrr+r5r6rKr[r��CloudInitPickleMixinr�r�rrrr�<module>s*

:-j#	

Spamworldpro Mini