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

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /usr/lib/python3.6/site-packages/cloudinit/sources/__pycache__/DataSourceAltCloud.cpython-36.pyc
3

��b)!�@s�dZddlZddlZddlZddlmZddlmZddlmZm	Z	m
Z
eje�Z
dZddgZid	d
id�Zdd
�ZGdd�dej�Zdd�ZeejejffgZdd�ZdS)zb
This file contains code used to gather the user data passed to an
instance on RHEVm and vSphere.
�N)�dmi)�log)�sources�subp�utilz/etc/sysconfig/cloud-infoZmodprobeZfloppyi�Z	localhost)zblock-device-mappingzinstance-idzlocal-hostnameZ	placementcCsp|d}|d}ytj|�j�}WnHtk
rjytj|�j�}Wn tk
rdtjtd�dSXYnX|S)an
    Description:
        This callback will be applied by util.mount_cb() on the mounted
        file.

        Deltacloud file name contains deltacloud. Those not using
        Deltacloud but instead instrumenting the injection, could
        drop deltacloud from the file name.

    Input:
        mount_dir - Mount directory

    Returns:
        User Data

    z/deltacloud-user-data.txtz/user-data.txtz Failed accessing user data file.N)r�	load_file�strip�IOError�logexc�LOG)Z	mount_dirZdeltacloud_user_data_fileZuser_data_fileZ	user_data�r�(/usr/lib/python3.6/DataSourceAltCloud.py�read_user_data_callback'src@sHeZdZdZdd�Zdd�Zdd�Zdd	�Zd
d�Zdd
�Z	dd�Z
dS)�DataSourceAltCloudZAltCloudcCs"tjj||||�d|_d|_dS)N�/�file://)rr)r�
DataSource�__init__�seedZsupported_seed_starts)�selfZsys_cfgZdistro�pathsrrr
rMszDataSourceAltCloud.__init__cCstjj|�}d||jfS)Nz%s [seed=%s])rr�__str__r)r�rootrrr
rRszDataSourceAltCloud.__str__cCs�tjjt�rJytjt�j�j�}Wn"tk
rDtj	t
dt�dSX|Stjd�}|s\dS|j�}|j
d�rrdS|j
d�r�dSdS)at
        Description:
            Get the type for the cloud back end this instance is running on
            by examining the string returned by reading either:
                CLOUD_INFO_FILE or
                the dmi data.

        Input:
            None

        Returns:
            One of the following strings:
            'RHEV', 'VSPHERE' or 'UNKNOWN'

        z'Unable to access cloud info file at %s.ZUNKNOWNzsystem-product-name�RHEVZVMWARE�VSPHERE)�os�path�exists�CLOUD_INFO_FILErrr�upperr	r
rrZ
read_dmi_data�
startswith)r�
cloud_typeZsystem_nameZsys_namerrr
�get_cloud_typeVs&


z!DataSourceAltCloud.get_cloud_typecCsbtjd�|j�}tjdt|��d|kr8|j�rRdSnd|krN|j�rRdSndStjtd�dS)a�
        Description:
            User Data is passed to the launching instance which
            is used to perform instance configuration.

            Cloud providers expose the user data differently.
            It is necessary to determine which cloud provider
            the current instance is running on to determine
            how to access the user data. Images built with
            image factory will contain a CLOUD_INFO_FILE which
            contains a string identifying the cloud provider.

            Images not built with Imagefactory will try to
            determine what the cloud provider is based on system
            information.
        zInvoked get_data()zcloud_type: %srTrFzFailed accessing user data.)r�debugr"�str�user_data_rhevm�user_data_vsphererr
)rr!rrr
�	_get_datas
zDataSourceAltCloud._get_datacCs:|j�}t|d�stj|_|dkr(d|_d|j�|jfS)z(Return the subplatform metadata details.�sourcerz/dev/fd0z%s (%s))r"�hasattrrZMETADATA_UNKNOWNr(�lower)rr!rrr
�_get_subplatform�s
z#DataSourceAltCloud._get_subplatformc,Csd}y
t�Wn0tjk
r>}ztjtd|�dSd}~XnXd}ytj|dd�Wn4tjtfk
r�}ztjtd|�dSd}~XnXytj|t	�}WnRtk
r�}z|j
t
jkr��WYdd}~Xn$tjk
r�tjtd|�YnX||_
t|_|�rd	SdSdS)
a�
        RHEVM specific userdata read

         If on RHEV-M the user data will be contained on the
         floppy device in file <user_data_file>
         To access it:
           modprobe floppy

           Leverage util.mount_cb to:
               mkdir <tmp mount dir>
               mount /dev/fd0 <tmp mount dir>
               The call back passed to util.mount_cb will do:
                   read <tmp mount dir>/<user_data_file>
        NzFailed modprobe: %sFz/dev/fd0�)rZtimeoutzFailed udevadm_settle: %s
z-Failed to mount %s when looking for user dataT)�modprobe_floppyrZProcessExecutionErrorrr
rZudevadm_settle�OSError�mount_cbr�errno�ENOENT�MountFailedError�userdata_raw�META_DATA_NOT_SUPPORTED�metadata)r�
return_str�eZ
floppy_dev�errrrr
r%�s6
z"DataSourceAltCloud.user_data_rhevmcCs�d}tjd�}x||D]t}ytj|t�}|r2||_PWqtk
rd}z|jtjkrT�WYdd}~Xqtjk
r�tj	t
d|�YqXqW||_t|_
|r�dSdSdS)a�
        vSphere specific userdata read

        If on vSphere the user data will be contained on the
        cdrom device in file <user_data_file>
        To access it:
           Leverage util.mount_cb to:
               mkdir <tmp mount dir>
               mount /dev/fd0 <tmp mount dir>
               The call back passed to util.mount_cb will do:
                   read <tmp mount dir>/<user_data_file>
        NzLABEL=CDROMz-Failed to mount %s when looking for user dataTF)rZfind_devs_withr/rr(r.r0r1r2r
rr3r4r5)rr6Z
cdrom_listZ	cdrom_devr8rrr
r&�s*

z$DataSourceAltCloud.user_data_vsphereN)�__name__�
__module__�__qualname__Zdsnamerrr"r'r+r%r&rrrr
rIs)'	6rcCs&tjt�\}}tjddjt�|�dS)NzCommand: %s
Output%s� )r�CMD_PROBE_FLOPPYrr#�join)�outZ_errrrr
r-sr-cCstj|t�S)N)rZlist_from_depends�datasources)Zdependsrrr
�get_datasource_listsrA)�__doc__r0rZos.pathZ	cloudinitrrZloggingrrrZ	getLoggerr9rrr=r4rrrr-ZDEP_FILESYSTEMZDEP_NETWORKr@rArrrr
�<module>
s&
"F


Youez - 2016 - github.com/yon3zu
LinuXploit