403Webshell
Server IP : 23.254.227.96  /  Your IP : 216.73.216.7
Web Server : Apache/2.4.62 (Unix) OpenSSL/1.1.1k
System : Linux hwsrv-1277026.hostwindsdns.com 4.18.0-477.13.1.el8_8.x86_64 #1 SMP Tue May 30 14:53:41 EDT 2023 x86_64
User : viralblo ( 1001)
PHP Version : 8.1.31
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : OFF  |  Sudo : ON  |  Pkexec : ON
Directory :  /usr/lib/python3.6/site-packages/cloudinit/cmd/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /usr/lib/python3.6/site-packages/cloudinit/cmd/__pycache__/main.cpython-36.opt-1.pyc
3

��b܇�@sddlZddlZddlZddlZddlZddlZddlmZej�ddl	m
Z
ddlmZddlm
Z
ddlmZddlmZddlmZdd	lmZdd
lmZddlmZddlmZdd
lmZddlmZddlmZmZmZmZddlmZddlmZddlm Z dZ!dZ"eeed�Z#ej$�Z%dCdd�Z&dDdd�Z'dd�Z(dd�Z)dd �Z*d!d"�Z+dFd%d&�Z,dGd(d)�Z-d*d+�Z.d,d-�Z/d.d/�Z0d0d1�Z1d2d3�Z2d4d5�Z3dHd6d7�Z4d8d9�Z5d:d;�Z6d<d=�Z7dId>d?�Z8e9d@k�r
dAej:k�r�dBej:dA<e8ej;�Z<e<�r
ej=e<�dS)J�N)�patcher)�validate_cloudconfig_schema)�log)�netinfo)�signal_handler)�sources)�stages)�
url_helper)�util)�version)�warnings)�	reporting)�events)�PER_INSTANCE�
PER_ALWAYS�PER_ONCE�CLOUD_CONFIG)�
atomic_helper)�cc_set_hostname)�
dhclient_hookzOCloud-init v. {version} running '{action}' at {timestamp}. Up {uptime} seconds.zcloud_%s_modules)�instance�always�once�cCs^|rtjjd|�tjjdd�tjjd�tjtjd�tjjdd�tjjd�dS)Nz%s
�-�<�
)�file)�sys�stderr�write�	traceback�	print_exc)�msg�r$�/usr/lib/python3.6/main.pyr"Esr"cCs&|st|�}tjd|ddtd�|S)Nz%s
FT)Zconsolerr)�welcome_formatr
Z	multi_log�LOG)�actionr#r$r$r%�welcomeOsr)cCstjtj�tj�tj�|d�S)N)r�uptimeZ	timestampr()�WELCOME_MSG_TPL�formatr�version_stringr
r*Ztime_rfc2822)r(r$r$r%r&Vs
r&cCs2g}|jr.x"|jD]}|jtjj|j��qW|S)N)�files�append�os�path�realpath�name)�argsZfn_cfgsZfhr$r$r%�extract_fns_s
r5cCsvt|}|j|�\}}t|�t|�}|dkrXd||f}tjjd|�tj|�gStjdt|�t|��|SdS)Nrz)No '%s' modules to run under section '%s'z%s
zRan %s modules with %s failures)�MOD_SECTION_TPLZrun_section�lenrrr r'�debug)�mods�action_nameZsectionZfull_section_name�	which_ran�failuresZtotal_attemptedr#r$r$r%�run_module_sectionls
r=cCs|jd�rtj|jd��dS)Nr
)�getr
Zupdate_configuration)�cfgr$r$r%�apply_reporting_cfgs
r@�cloud-config-url�urlcCs@tj|�}x |D]}||kr|||fSqWtd||f��dS)Nz!No keys (%s) found in string '%s')r
Zkeyval_str_to_dict�KeyError)�cmdline�names�data�keyr$r$r%�parse_cmdline_url�s


rHTc
Cs�|dkrtj�}yt|�\}}Wntk
r:tjdfSX|jd�pN|jd�}|r�tjj	|�r�|r�d||f}tj
}|r�tj}nd||f}tj}||fS|ddd	�}|s�|r�tj}d
|d<ntj}d|d<d}	d
}
yjtj
f|�}|j��r,|j}	|jj|
��s>|dk�rtj}ntj
}|d||
ffSn|d||jffSWn0tjk
�rp}z|d||ffSd}~XnXtj||	dd�tj
d|||ffS)a�Write data from url referenced in command line to path.

    path: a file to write content to if downloaded.
    network: should network access be assumed.
    cmdline: the cmdline to parse for cloud-config-url.

    This is used in MAAS datasource, in "ephemeral" (read-only root)
    environment where the instance netboots to iscsi ro root.
    and the entity that controls the pxe config has to configure
    the maas datasource.

    An attempt is made on network urls even in local datasource
    for case of network set up in initramfs.

    Return value is a tuple of a logger function (logging.DEBUG)
    and a message indicating what happened.
    Nz!No kernel command line url found.zfile://�/z_file '%s' existed, possibly from local stage download of command line url '%s'. Not re-writing.zafile '%s' existed, possibly from previous boot download of command line url '%s'. Not re-writing.�
�)rBZtimeoutZretries�Zsec_betweeng�������?s
#cloud-configzcloud-config-urlz&contents of '%s' did not start with %sz$url '%s' returned code %s. Ignoring.zretrieving url '%s' failed: %si�)�modez*wrote cloud-config data from %s='%s' to %s)r
Zget_cmdlinerHrC�logging�DEBUG�
startswithr0r1�exists�INFO�WARNr	Zread_file_or_url�ok�contents�codeZUrlError�
write_file)
r1�networkrDZcmdline_namerBZ
path_is_local�m�level�kwargsrF�headerZresp�er$r$r%�attempt_cmdline_url�sX




r^cCs�dtjjtjjf}tjj|jjd�d�}tjj	|�rlt
|�j�}||kr�tj
d�|jd�tj||�n*tjj	|jjd��r�tjd�tj||�dS)	z�Purge the cache if python version changed on us.

    There could be changes not represented in our cache (obj.pkl) after we
    upgrade to a new version of python, so at that point clear the cache
    z%d.%drFzpython-versionz-Python version change detected. Purging cacheTZobj_pklzMWriting python-version file. Cache compatibility status is currently unknown.N)r�version_info�major�minorr0r1�join�paths�	get_cpathrQ�open�readr'r8�purge_cacher
rW�
get_ipath_cur�info)�initZcurrent_python_versionZpython_version_pathZcached_python_versionr$r$r%�$purge_cache_on_python_version_change�s

rkcCstj|jd�rdS|jS)NZdisable_network_activationF)r
�get_cfg_option_boolr?�local)rjr4r$r$r%�_should_bring_up_interfacessrnc-Cs�tjtjg}|jrtjg}ttjjdtd�|jd�g}|jsJt	|�}nt	d|�}t
j||jd�}|j
t|��d}d}y.|jtjdf�tj�tj|j|�\}}Wn<tk
r�d}tjt|�t|�|jtj|f�YnX|j�rtjd�tj�tj|j�t|j�t||d	�x|D]\}	}tj |	|��q*Wy|j!�Wn"tk
�rrtjtd
�YnX|j"}
t#|�|j�r�tj$ntj%}|tj%k�r.d}t&j'j(dt)j*��tjd
�tjj|
j+d�d�g}
g}x&|
D]}tjj,|��r�|j|��q�W|�r"tjd||�dgfStjd�ntd}tj-|jdd�}|�rXtjd�d}n(|
j.d�}tjj/|��r�tjd|�d}|j0�tj1tjj|
j+d�d��t2||�}yB|j3|d�|tj%k�r�|j4j5|k�r�tjd||j4�dgfSWn�tj6k
�rv|tj$k�rtjd�ntjtd�|j7�sf|j8|d�tjd|�|tj$k�rZdgfSddgfSntjd|�YnXt9|�|j:�}tjd ||||j;��|tj$k�r�t<|d!d"d#�|j8|d�|tj$k�r|j4j5|k�r�tjd$||j4�|j4gfStjd%||j4�|j=�|j>�t<|d&d'd#�y2|j?�j@d(|jAtBgtBd)�\}}|�sV|jAtC�Wn*tk
�r�tjtd*�|j4d*gfSXtjj/|j"j.d+���r�tD|jdd,�n
tjd-�t|j�t
jE|t|�|jd.�}yR|}|}tjF|j|�\}}||k�s||k�r$tjGd/||�tj|j|�\}}Wn"tk
�rHtjtd0�YnXtj|j�|jH�tI|j4|jd1�|j4tJ|||�fS)2Nz%s.dz91_kernel_cmdline_url.cfg)r1rXz%s-local)�ds_deps�reporterzClosing stdin.z#Failed to setup output redirection!z@Logging being reset, this logger may no longer be active shortly)r#z0Failed to initialize, likely bad things to come!�trustz%s
zjChecking to see if files that we need already exist from a previous run that would allow us to stop early.rFzno-netz"[%s] Exiting. stop file %s existedzQExecution continuing, no previous run detected that would allow us to stop early.ZcheckZmanual_cache_cleanFz"manual cache clean set from configZmanual_clean_markerz(manual cache clean found from marker: %s)�existingz)[%s] Exiting. datasource %s in local modezNo local datasource foundz8No instance datasource found! Likely bad things to come!)Zbring_upz[%s] Exiting without datasourcezNo instance datasource found.z2[%s] barreling on in force mode without datasourcez5[%s] %s will now be targeting instance id: %s. new=%srmrX)�stage�retry_stagez.[%s] Exiting. datasource %s not in local mode.z6[%s] %s is in local mode, will apply init modules now.zinit-netzmodules:config�consume_data)r4ZfreqzConsuming user data failed!Zuserdata_raw)�config�strictz2Skipping user-data validation. No user-data found.)rpz#Stdout, stderr changing to (%s, %s)z'Failed to re-adjust output redirection!)�
datasourcer?)KrZDEP_FILESYSTEMZDEP_NETWORKrmr^r0r1rbrr&r�Initrp�read_cfgr5r/rNrOr
�close_stdin�fixup_outputr?�	Exception�logexcr'r"rSr8�resetLogging�setupLoggingr@r)rZ
initializercrkZDSMODE_LOCALZDSMODE_NETWORKrrr rZ
debug_inford�isfilerlrhrQrg�del_filern�fetchrxZdsmode�DataSourceNotFoundException�forceZapply_network_config�_maybe_persist_instance_dataZ
instancifyZis_new_instance�_maybe_set_hostnameZsetup_datasource�update�cloudifyZrunrurrr�ModulesZget_output_cfg�warningZactivate_datasource�di_report_warnr=)r3r4ZdepsZ
early_logs�w_msgrjZoutfmtZerrfmtr#ZlvlZpath_helperrMrrZ
stop_filesZexisting_files�fnZmcfgZmfileZbring_up_interfacesZiidZranZ_resultsr9Zoutfmt_origZerrfmt_origr$r$r%�	main_inits











r�cCs�d|krtjd�dS|d}|dkr4tjd�dSt|t�sNtjd|�dS|jd�}|dkrntjd�dSt|t�s�tjd|�dS|jjd�d	}|j	t
j�r�|tt
j�d�}ntjd
||�||kr�tjd|||�dSt
jd||t|�d
�dS)NZ	di_reportzno di_report found in config.zdi_report was None.z%di_report config not a dictionary: %sZdatasource_listz(no 'datasource_list' found in di_report.z(di_report/datasource_list not a list: %s�.rKz1Datasource '%s' came from unexpected module '%s'.z:used datasource '%s' from '%s' was in di_report's list: %sZdsid_missing_source)�source�dslist)r'r8�
isinstance�dictr�r>�list�
__module__�
rpartitionrPrZ	DS_PREFIXr7rZshow_warning�str)rxr?Zdicfgr��modnamer$r$r%r��sB





r�cCs0|j}td||f�}tjg|jd�}|jt|��y|jdd�Wn>tj	k
r�d|}t
jt|�t
|�|js~|gSYnXt|�tj|t|�|jd�}y$tjd�t
j�t
j|j|�Wn tk
r�t
jtd�YnX|j�rtjd	�tj�tj|j�t|j�t||d
�t|||�S)Nz%s:%s)rorprq)rrzGCan not apply stage %s, no datasource found! Likely bad things to come!)rpz
Closing stdinz#Failed to setup output redirection!z@Logging being reset, this logger may no longer be active shortly)r#)rMr&rryrprzr5r�rr�r
r~r'r"r�r�r�r8r{r|r?r}rNrr�r@r)r=)r:r4r3r�rjr#r9r$r$r%�main_modules/s:

r�c
Cs�|j}t|�}tjg|jd�}|jt|��y|jdd�Wn4tj	k
rpt
jtd�t
d�|jsldSYnXt|�tj|t|�|jd�}|j}|r�tjd|�|j}|r�tjd|�tj|�}y$tjd	�t
j�t
j|jd�Wn"tk
�rt
jtd
�YnX|j�r(tjd�tj�tj|j�t|j�t||d�|j|||�\}}	|	�rrtj d
|�dS|�s�tj d|�dSdSdS)N)rorprq)rrz;Failed to fetch your datasource, likely bad things to come!rL)rpzUsing passed in arguments %szUsing passed in frequency %sz
Closing stdinz#Failed to setup output redirection!z@Logging being reset, this logger may no longer be active shortly)r#zRan %s but it failed!zDid not run %s, does it exist?r)!r3r&rryrprzr5r�rr�r
r~r'r"r�r�r��module_argsr8Z	frequency�FREQ_SHORT_NAMESr>r{r|r?r}rNrr�r@r)Z
run_singler�)
r3r4Zmod_namer�rjr9Zmod_argsZmod_freqr;r<r$r$r%�main_singlefsV	



r�cCs|dkrtjjd�}|dkr(tjjd�}tjj|d�}tjj|d�}tjj|d�}tjj|d�}tj||f�|j\}}	|dkr�|jr�d}
q�d}
n |dkr�d|j}
nt	d	|��d}|
|kr�t	d
j
|
���d}|
dk�r�xL||||fD]}
tj|
�q�Wn,ytj
tj|��}Wntk
�r&YnXgddd�}|dk�rRdii}d|dd<x,|D]$}||dk�rX|j�|d|<�qXW|d}|
|d<tj�||
d<tj||�tjtjj||�|dd�yR|	||�}|
dk�r�|\}}|dk	�rt|�|d<n|}dd�|D�||
d<WnPtk
�rh}z2tjtd|
�td|
�t|�g||
d<WYdd}~XnXtj�||
d<d|d<tj||�|
dk�rg}x2|D]*}||d�r�|j||jdg���q�Wtj|d|d|d�i�tjtjj||�|dd�t||
d�S)Nz/var/lib/cloud/dataz/run/cloud-initzstatus.jsonzresult.jsonrj�
init-local�modulesz
modules-%szunknown name: %s�modules-init�modules-config�
modules-finalz'Invalid cloud init mode specified '{0}')�errors�start�finished�v1rxrsr�T)r�cSsg|]}t|��qSr$)r�)�.0r]r$r$r%�
<listcomp>sz"status_wrapper.<locals>.<listcomp>r�zfailed stage %szfailed run of stage %sr�)rxr�)rjr�r�r�r�)rjr�)r0r1�normpathrbr
Zensure_dirsr(rmrM�
ValueErrorr,r��json�loadsZ	load_filer}�copy�timerZ
write_jsonZsym_link�relpathr�r~r'r"�extendr>r7)r3r4Zdata_dZlink_dZstatus_pathZstatus_linkZresult_pathZresult_link�_name�functorrMZmodes�status�fZ
nullstatusrYr��retrxr�r]r$r$r%�status_wrapper�s�






$

r�cCs4|jr0tjj|jjtj�}tjj|�s0|j	j
�dS)zCWrite instance-data.json file if absent and datasource is restored.N)Zds_restoredr0r1rbrcZrun_dirrZINSTANCE_JSON_FILErQrxZpersist_instance_data)rjZinstance_data_filer$r$r%r�s
r�cCsx|j�}tj|j|dd�\}}|rtytjd|j|td�Wn8tjk
rr}ztjd||t	|��WYdd}~XnXdS)z�Call set-hostname if metadata, vendordata or userdata provides it.

    @param stage: String representing current stage in which we are running.
    @param retry_stage: String represented logs upon error setting hostname.
    T)Z
metadata_onlyzset-hostnameNzGFailed setting hostname in %s stage. Will retry in %s stage. Error: %s.)
r�r
Zget_hostname_fqdnr?rZhandler'ZSetHostnameErrorr8r�)rjrsrtZcloudZhostnameZ_fqdnr]r$r$r%r�)sr�cCs tjjdjttj��d�dS)Nr)r�stdoutr rb�sortedrZFEATURES)r3r4r$r$r%�
main_features@sr�cCsJ|s
tj}tj|dd�}|dd�}|jddddtj�d�|jd	d
ddd
tjd�d�|jdddddd�|jdddddd�|jdd�|j	ddd�}d|_
|jdd d!�}|jd"d#dd$dd�|jdtfd%�|jd&d'd!�}|jd(d)d*d+d,d`d.�|jd&t
fd%�|jd/d0d!�}|jd1d2d*d3dd4�|jd5d*d6dttj��d7�|jd8dd9dd4�|jd:d;d<d=d>�|jd/tfd%�|jd?d@d!�}|jtjtjd!�}tj|�|jdAdBd!�}|jdAtfd%�|jdCdDd!�}	|jdEdFd!�}
|jdGdHd!�}|jdIdJd!�}|jdKdLd!�}
|�r8|ddCk�r6ddMlm}||	��n|ddEk�rZddMlm}||
�n�|ddGk�r�ddNlm}m}||�|jdG|fd%�n�|ddIk�r�ddOlm}m}||�|jdI|fd%�nn|dd?k�rddPlm}m}||�|jdQ|fd%�n6|ddKk�r8ddRlm}m }||
�|
jdK|fd%�|j!|dS�}|j"\}}|j#�r^t$j%�t&j'�|dak�rtt(}d}d}|dk�r�|j)�r�db\}}ndc\}}nZ|d&k�r�dX|j*dY|j*}}n8|d/k�r�dZ|j+d[|j+}}|j,}n|}d\|}d}t-j.|||d]�|_/|j/�,t0j1t2j#d^|d|||fd_�}t3j4�|SQRXdS)dNr)�progrLz	--versionz-vrz	%(prog)s )r(rz--filez-fr/r.z*additional yaml configuration files to use�rb)r(�dest�help�typez--debugz-d�
store_truez9show additional pre-action logging (default: %(default)s)F)r(r��defaultz--forcezCforce running even if no datasource is found (use at your own risk)r�)r(r�r�r�)rpZSubcommandsZ
subcommand)�titler�Trjz3initializes cloud-init and performs initial modules)r�z--localz-lz*start in local mode (default: %(default)s))r(r�z1activates modules using a given configuration keyz--modez-mZstorez7module configuration name to use (default: %(default)s)rv�final)r(r�r��choicesZsinglezrun a single module z--namez-nzmodule name to run)r(r��requiredz--frequencyzfrequency of the module)r(r�r�r�z--reportzenable reportingr��*Zargumentz/any additional arguments to pass to this module)�nargs�metavarr�Zqueryz;Query standardized instance metadata from the command line.Zfeatureszlist defined featuresZanalyzez,Devel tool: Analyze cloud-init logs and dataZdevelzRun development toolszcollect-logsz)Collect and tar all cloud-init debug infoZcleanz3Remove logs and artifacts so cloud-init can re-run.r�z/Report cloud-init status or wait on completion.)�
get_parser)r��handle_collect_logs_args)r��handle_clean_args)r��handle_argsZrender)r��handle_status_args)r4�
init-local�searching for local datasources�init-network�!searching for network datasourcesz
modules-%szrunning modules for %sz	single/%szrunning single module %szrunning 'cloud-init %s')Zreporting_enabledzcloud-init mode '%s')Zlogfuncr#Z
get_uptime�funcr4)rjrvr�)r�rj)r�r�)r�r�)5r�argv�argparse�ArgumentParser�add_argumentrr-ZFileTypeZset_defaultsZadd_subparsersr�Z
add_parserr�r�r�r��keysr�r�NAME�__doc__r�r�Zcloudinit.analyze.__main__Zcloudinit.cmd.devel.parserZcloudinit.cmd.devel.logsr�Zcloudinit.cmd.cleanr�Zcloudinit.cmd.queryr�Zcloudinit.cmd.statusr��
parse_argsr(r8rNZsetupBasicLoggingrZattach_handlersr�rmrMr3ZreportrZReportEventStackrpr
Zlog_timer'r
Zflush_events)Z	sysv_args�parserZ
subparsersZparser_initZ
parser_modZ
parser_singleZparser_queryZparser_dhclientZparser_featuresZparser_analyzeZparser_develZparser_collect_logsZparser_cleanZ
parser_statusZanalyze_parserZdevel_parserZlogs_parserr�Zclean_parserr�Zquery_parserZhandle_query_argsZ
status_parserr�r4r3r�ZrnameZ	report_onZrdescZretvalr$r$r%�mainDs0
















r��__main__ZTZz:/etc/localtime)r)N�rArB)r�)TN)NN)N)>r�r�r0rr�r!Z	cloudinitrZ
patch_loggingZcloudinit.config.schemarrrNrrrrr	r
rrr
Zcloudinit.reportingrZcloudinit.settingsrrrrrZcloudinit.configrrr+r6r�Z	getLoggerr'r"r)r&r5r=r@rHr^rkrnr�r�r�r�r�r�r�r�r��__name__�environr�Zreturn_value�exitr$r$r$r%�<module>sp


	


Ww27G
r

s




Youez - 2016 - github.com/yon3zu
LinuXploit