OS : Linux
PHP Version : 7.4.33
Software : Apache/2.4.6 (CentOS) PHP/7.4.33
Information System : Linux apprendre2 3.10.0-1160.119.1.el7.x86_64 #1 SMP Tue Jun 4 14:43:51 UTC 2024 x86_64
Disable Function : ó
oBú]c @ s d Z d d l Z d d l Z d d l Z d d l m Z d d l m Z d d l m Z d d l m
Z
e j e ƒ Z
d Z d d g Z i i d
6d d 6d
d 6i d 6Z d „ Z d e j f d „ ƒ YZ d „ Z e e j e j f f g Z d „ Z d S( sb
This file contains code used to gather the user data passed to an
instance on RHEVm and vSphere.
iÿÿÿÿN( t log( t sources( t util( t ProcessExecutionErrors /etc/sysconfig/cloud-infot modprobet floppys block-device-mappingiÇ s instance-idt localhosts local-hostnamet placementc C sƒ | d } | d } y t j | ƒ j ƒ } WnO t k
r~ y t j | ƒ j ƒ } Wq t k
rz t j t d ƒ d SXn X| S( sn
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
s /deltacloud-user-data.txts /user-data.txts Failed accessing user data file.N( R t load_filet stript IOErrort logexct LOGt None( t mount_dirt deltacloud_user_data_filet user_data_filet user_data( ( sH /usr/lib/python2.7/site-packages/cloudinit/sources/DataSourceAltCloud.pyt read_user_data_callback) s
t DataSourceAltCloudc B sM e Z d Z d „ Z d „ Z d „ Z d „ Z d „ Z d „ Z d „ Z RS( t AltCloudc C s/ t j j | | | | ƒ d | _ d | _ d S( Nt /s file://( R s file://( R t
DataSourcet __init__R
t seedt supported_seed_starts( t selft sys_cfgt distrot paths( ( sH /usr/lib/python2.7/site-packages/cloudinit/sources/DataSourceAltCloud.pyR O s c C s# t j j | ƒ } d | | j f S( Ns %s [seed=%s]( R R t __str__R ( R t root( ( sH /usr/lib/python2.7/site-packages/cloudinit/sources/DataSourceAltCloud.pyR T s c C s¬ t j j t ƒ r] y t j t ƒ j ƒ j ƒ } Wn% t k
rX t j t
d t ƒ d SX| St j d ƒ } | sv d S| j ƒ } | j d ƒ r• d S| j d ƒ r¨ d Sd S( st
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'
s' Unable to access cloud info file at %s.t UNKNOWNs system-product-namet RHEVt VMWAREt VSPHERE(
t ost patht existst CLOUD_INFO_FILER R R t upperR
R R t
read_dmi_datat
startswith( R t
cloud_typet system_namet sys_name( ( sH /usr/lib/python2.7/site-packages/cloudinit/sources/DataSourceAltCloud.pyt get_cloud_typeX s"
c C s… t j d ƒ | j ƒ } t j d t | ƒ ƒ d | k rN | j ƒ rq t Sn# d | k rm | j ƒ rq t Sn t St j t d ƒ t S( sœ
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.
s Invoked get_data()s cloud_type: %sR! R# s Failed accessing user data.(
R t debugR. t strt user_data_rhevmt Truet user_data_vspheret FalseR R ( R R+ ( ( sH /usr/lib/python2.7/site-packages/cloudinit/sources/DataSourceAltCloud.pyt _get_data~ s
c C sY | j ƒ } t | d ƒ s* t j | _ n | d k rB d | _ n d | j ƒ | j f S( s( Return the subplatform metadata details.t sourceR! s /dev/fd0s %s (%s)( R. t hasattrR t METADATA_UNKNOWNR6 t lower( R R+ ( ( sH /usr/lib/python2.7/site-packages/cloudinit/sources/DataSourceAltCloud.pyt _get_subplatform¥ s c C s d } y t ƒ Wn' t k
r: } t j t d | ƒ t SXd } y t j d | d d ƒ Wn- t t f k
rŠ } t j t d | ƒ t SXy t j | t
ƒ } WnQ t k
rÎ } | j t j k rõ ‚ qõ n' t j
k
rô t j t d | ƒ n X| | _ t | _ | rt St Sd S( s¿
RHEVM specific userdata read
If on RHEV-M the user data will be contained on the
floppy device in file