Viewing File: /usr/lib/python2.7/site-packages/cloudinit/sources/DataSourceAltCloud.pyc
ó
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"