Current 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'