404

[ Avaa Bypassed ]




Upload:

Command:

elspacio@3.147.53.214: ~ $
3

\�me�+�@s�ddlZddlZddlmZmZmZddlmZmZddl	m
Z
ddlmZddl
mZeje�ZdZdZd	eiZd!Zd"Zd#Zedd�eD��ZGdd�dejej�Zdd�Zdd�Zd$dd�Zdd�Z d%dd�Z!eZ"eej#ffgZ$dd �Z%dS)&�N)�sources�subp�util)�
EventScope�	EventType)�eni)�get_ibm_platform)�	openstackziid-dsconfigdrive�passzinstance-id�vfat�iso9660�config-2�CONFIG-2�sr�cdccs*|]"}tdd�D]}d||fVqqdS)r�z	/dev/%s%sN)�range)�.0�z�i�r�+/usr/lib/python3.6/DataSourceConfigDrive.py�	<genexpr>srcsreZdZdZejejejej	ej
hiZ�fdd�Zdd�Z
dd�Zdd	�Zed
d��Zedd
��Zdd�Z�ZS)�DataSourceConfigDriveZConfigDrivecs\tt|�j|||�d|_tjj|jd�|_d|_d|_	d|_
tj|_
d|_d|_i|_dS)NZconfig_drive)�superr�__init__�source�os�path�join�seed_dir�version�ec2_metadata�_network_configr�UNSET�network_json�network_eni�
known_macs�files)�self�sys_cfg�distro�paths)�	__class__rrr/szDataSourceConfigDrive.__init__cCs0tjj|�}d||j|jf}|d|j7}|S)Nz%s [%s,ver=%s]z[source=%s])r�
DataSource�__str__�dsmoder!r)r)�rootZmstrrrrr/;szDataSourceConfigDrive.__str__c
Cs�d}i}i}xX|jdfD]J}tjj|�s*qyt|�}|}PWqtjk
r`tjt	d|�YqXqW|�s|j
jd�}x�t|d�D]�}d}tj
�r�|jd�r�d}ytj|t|d�}|}WnNtjk
r�Yn:tjk
r�Yn&tjk
�rtjt	d|�YnX|r�Pq�W|�sd	S|jd
i�}tj|tg�}|j|jd�|jjd�|dd
k�rbtjndg�|_|jtjk�r~d	St|j�}|d}	||	k�r�t||j|jtjkd�|jtjk�r�t	jd||j�d	S||_||_ |jd�|_!|jd�|_"|d|_#|j$j%|jdi��|jd�}
|
|_&ytj'|
�|_(Wn6t)k
�rl}zt	j*d|�d|_(WYdd}~XnX|jd�}||_+ytj'|�|_,Wn6t)k
�r�}zt	j*d|�d|_,WYdd}~XnX|jd�|_-|jd�|_.dS)Nz
/config-drivez#Failed reading config drive from %sZdatasource_list)�dslistz/dev/cdZcd9660)�mtypezBroken config drive: %sF�metadatar0r!�zinstance-id)r+�networkz&%s: not claiming datasource, dsmode=%szec2-metadataZuserdatar(Z
vendordataz"Invalid content in vendor-data: %sZvendordata2z#Invalid content in vendor-data2: %s�network_configZnetworkdataT)/r rr�isdir�read_config_driver	�NonReadabler�logexc�LOGr*�get�find_candidate_devsZis_BSD�
startswithZmount_cbZMountFailedErrorZBrokenMetadataZ
mergemanydict�DEFAULT_METADATAZ_determine_dsmodeZds_cfgrZDSMODE_PASSr0ZDSMODE_DISABLED�get_previous_iidr,�
on_first_bootr+�debugrr4r"Zuserdata_rawr!r(�updateZvendordata_pureZconvert_vendordataZvendordata_raw�
ValueError�warningZvendordata2_pureZvendordata2_rawr&r%)
r)�foundZmd�resultsZsdirr2Zdevr3Zprev_iidZcur_iidZvd�eZvd2rrr�	_get_dataAs�






zDataSourceConfigDrive._get_datacCstj|j��S)N)rZinstance_id_matches_system_uuidZget_instance_id)r)r*rrr�check_instance_id�sz'DataSourceConfigDrive.check_instance_idcCsn|jdkrh|jdtjfkr:tjd�tj|j|jd�|_n.|j	dk	r^t
j|j	�|_tjd�n
tjd�|jS)Nz(network config provided via network_json)r'z.network config provided via converted eni dataz"no network configuration available)r#r%rr$r<rCr	Zconvert_net_jsonr'r&r�convert_eni_data)r)rrrr7�s



z$DataSourceConfigDrive.network_configcCsdS)Nr	r)r)rrr�platform�szDataSourceConfigDrive.platformcCs$|jjd�rd}nd}d||jfS)z/Return the subplatform metadata source details.z/devzconfig-diskzseed-dirz%s (%s))rr?)r)Zsubplatform_typerrr�_get_subplatform�sz&DataSourceConfigDrive._get_subplatform)�__name__�
__module__�__qualname__ZdsnamerZNETWORKrZBOOT_NEW_INSTANCEZBOOTZBOOT_LEGACYZHOTPLUGZsupported_update_eventsrr/rJrK�propertyr7rMrN�
__classcell__rr)r-rr"s
frcCs�tj|�}|jgif|jgifg}g}xL|D]D\}}}y
|||�Stjk
rn}z|j|�WYdd}~Xq,Xq,W|d�dS)Nr5���)r	ZConfigDriveReaderZread_v2Zread_v1r:�append)Z
source_dir�readerZfindersZexcpsZfunctor�args�kwargsrIrrrr9�s


 r9cCs>tjj|jd�d�}ytj|�jd�Stk
r8dSXdS)N�datazinstance-id�
)rrrZ	get_cpathrZ	load_file�rstrip�IOError)r,ZfnamerrrrA�s
rATcCs^t|t�stdt|���|rL|jdd�}|rL|rLtjd�|jtj	|��t
|jd��dS)zDPerforms any first-boot actions using data read from a config-drive.z/Config-drive data expected to be a dict; not %sr7�z-Updating network interfaces from config driver(N)�
isinstance�dict�	TypeError�typer=r<rFZapply_network_configrrL�write_injected_files)rYr+r6Znet_confrrrrB�s

rBcCs||rxtjdt|��xb|j�D]V\}}|jtj�s<tj|}ytj||dd�Wqt	k
rrtj
td|�YqXqWdS)NzWriting %s injected filesi�)�modezFailed writing file: %s)r<rC�len�itemsr?r�seprZ
write_filer\r;)r(�filenameZcontentrrrrb�s
rbc
s|dkrg}|rFx4tD],}ytj|d�Wqtjk
r@YqXqWg}x tD]}|jtjd|��qPWg�x tD]}�jtjd|��qvW|jdd��jdd���fdd�|D�}�fd	d�|D�}t	j
d
||�|o�d|k�rt�\}}	|	|k�r|j|	�t	j
d|	|�|S)
aReturn a list of devices that may contain the config drive.

    The returned list is sorted by search order where the first item has
    should be searched first (highest priority)

    config drive v1:
       Per documentation, this is "associated as the last available disk on the
       instance", and should be VFAT.
       Currently, we do not restrict search list to "last available disk"

    config drive v2:
       Disk should be:
        * either vfat or iso9660 formatted
        * labeled with 'config-2' or 'CONFIG-2'
    N)rzTYPE=%szLABEL=%sT)�reversecsg|]}|�kr|�qSrr)r�d)�by_labelrr�
<listcomp>%sz'find_candidate_devs.<locals>.<listcomp>cs$g|]}|�kstj|�r|�qSr)rZis_partition)rri)rjrrrk*szdevices=%s dslist=%sZIBMCloudz5IBMCloud device '%s' (%s) removed from candidate list)
�OPTICAL_DEVICESrZfind_devs_withrZProcessExecutionError�FS_TYPES�extend�LABEL_TYPES�sortr<rCr�remove)
Z
probe_opticalr2ZdeviceZ	by_fstypeZfs_typeZlabelZ
candidatesZdevicesZibm_platformZibm_pathr)rjrr>�s8






r>cCstj|t�S)N)rZlist_from_depends�datasources)Zdependsrrr�get_datasource_listFsrs)rr)r
r)rr)NT)TN)&ZloggingrZ	cloudinitrrrZcloudinit.eventrrZ
cloudinit.netrZ$cloudinit.sources.DataSourceIBMCloudrZcloudinit.sources.helpersr	Z	getLoggerrOr<ZDEFAULT_IIDZDEFAULT_MODEr@rmroZPOSSIBLE_MOUNTS�tuplerlZSourceMixinr.rr9rArBrbr>ZDataSourceConfigDriveNetZDEP_FILESYSTEMrrrsrrrr�<module>	s2
&

B

Filemanager

Name Type Size Permission Actions
DataSourceAkamai.cpython-36.opt-1.pyc File 8.18 KB 0644
DataSourceAkamai.cpython-36.pyc File 8.18 KB 0644
DataSourceAliYun.cpython-36.opt-1.pyc File 3.22 KB 0644
DataSourceAliYun.cpython-36.pyc File 3.22 KB 0644
DataSourceAltCloud.cpython-36.opt-1.pyc File 6.74 KB 0644
DataSourceAltCloud.cpython-36.pyc File 6.74 KB 0644
DataSourceAzure.cpython-36.opt-1.pyc File 47.95 KB 0644
DataSourceAzure.cpython-36.pyc File 47.95 KB 0644
DataSourceBigstep.cpython-36.opt-1.pyc File 1.84 KB 0644
DataSourceBigstep.cpython-36.pyc File 1.84 KB 0644
DataSourceCloudSigma.cpython-36.opt-1.pyc File 3.62 KB 0644
DataSourceCloudSigma.cpython-36.pyc File 3.62 KB 0644
DataSourceCloudStack.cpython-36.opt-1.pyc File 5.97 KB 0644
DataSourceCloudStack.cpython-36.pyc File 5.97 KB 0644
DataSourceConfigDrive.cpython-36.opt-1.pyc File 8.18 KB 0644
DataSourceConfigDrive.cpython-36.pyc File 8.18 KB 0644
DataSourceDigitalOcean.cpython-36.opt-1.pyc File 3.65 KB 0644
DataSourceDigitalOcean.cpython-36.pyc File 3.65 KB 0644
DataSourceEc2.cpython-36.opt-1.pyc File 23.49 KB 0644
DataSourceEc2.cpython-36.pyc File 23.49 KB 0644
DataSourceExoscale.cpython-36.opt-1.pyc File 5.92 KB 0644
DataSourceExoscale.cpython-36.pyc File 5.92 KB 0644
DataSourceGCE.cpython-36.opt-1.pyc File 9.83 KB 0644
DataSourceGCE.cpython-36.pyc File 9.93 KB 0644
DataSourceHetzner.cpython-36.opt-1.pyc File 3.78 KB 0644
DataSourceHetzner.cpython-36.pyc File 3.78 KB 0644
DataSourceIBMCloud.cpython-36.opt-1.pyc File 12.44 KB 0644
DataSourceIBMCloud.cpython-36.pyc File 12.44 KB 0644
DataSourceLXD.cpython-36.opt-1.pyc File 13.31 KB 0644
DataSourceLXD.cpython-36.pyc File 13.31 KB 0644
DataSourceMAAS.cpython-36.opt-1.pyc File 11.86 KB 0644
DataSourceMAAS.cpython-36.pyc File 11.86 KB 0644
DataSourceNWCS.cpython-36.opt-1.pyc File 3.77 KB 0644
DataSourceNWCS.cpython-36.pyc File 3.77 KB 0644
DataSourceNoCloud.cpython-36.opt-1.pyc File 7.97 KB 0644
DataSourceNoCloud.cpython-36.pyc File 7.97 KB 0644
DataSourceNone.cpython-36.opt-1.pyc File 1.47 KB 0644
DataSourceNone.cpython-36.pyc File 1.47 KB 0644
DataSourceOVF.cpython-36.opt-1.pyc File 9.15 KB 0644
DataSourceOVF.cpython-36.pyc File 9.15 KB 0644
DataSourceOpenNebula.cpython-36.opt-1.pyc File 11.75 KB 0644
DataSourceOpenNebula.cpython-36.pyc File 11.75 KB 0644
DataSourceOpenStack.cpython-36.opt-1.pyc File 7.91 KB 0644
DataSourceOpenStack.cpython-36.pyc File 7.91 KB 0644
DataSourceOracle.cpython-36.opt-1.pyc File 10.99 KB 0644
DataSourceOracle.cpython-36.pyc File 10.99 KB 0644
DataSourceRbxCloud.cpython-36.opt-1.pyc File 7.19 KB 0644
DataSourceRbxCloud.cpython-36.pyc File 7.19 KB 0644
DataSourceScaleway.cpython-36.opt-1.pyc File 10.84 KB 0644
DataSourceScaleway.cpython-36.pyc File 10.84 KB 0644
DataSourceSmartOS.cpython-36.opt-1.pyc File 24.51 KB 0644
DataSourceSmartOS.cpython-36.pyc File 24.51 KB 0644
DataSourceUpCloud.cpython-36.opt-1.pyc File 4.36 KB 0644
DataSourceUpCloud.cpython-36.pyc File 4.36 KB 0644
DataSourceVMware.cpython-36.opt-1.pyc File 23.66 KB 0644
DataSourceVMware.cpython-36.pyc File 23.66 KB 0644
DataSourceVultr.cpython-36.opt-1.pyc File 3.44 KB 0644
DataSourceVultr.cpython-36.pyc File 3.44 KB 0644
__init__.cpython-36.opt-1.pyc File 30.52 KB 0644
__init__.cpython-36.pyc File 30.52 KB 0644