Current File : //usr/lib/python2.7/site-packages/cloudinit/sources/DataSourceCloudSigma.pyo
�
oB�]c@s�ddlmZddlZddlmZmZddlmZddlm	Z	ddlm
Z
eje�Z
de	jfd��YZeZee	jffgZd	�ZdS(
i����(t	b64decodeN(tCepkotSERIAL_PORT(tlog(tsources(tutiltDataSourceCloudSigmacBs\eZdZdZd�Zd�Zd�Zd�Zeeed�Z	d�Z
d�ZRS(	s�
    Uses cepko in order to gather the server context from the VM.

    For more information about CloudSigma's Server Context:
    http://cloudsigma-docs.readthedocs.org/en/latest/server_context.html
    t
CloudSigmacCs2t�|_d|_tjj||||�dS(Nt(Rtcepkotssh_public_keyRt
DataSourcet__init__(tselftsys_cfgtdistrotpaths((sJ/usr/lib/python2.7/site-packages/cloudinit/sources/DataSourceCloudSigma.pyRs	cCsStjd�tjd�}|s3tjd�tStjd|�d|j�kS(s
        Uses dmi data to detect if this instance of cloud-init is running
        in the CloudSigma's infrastructure.
        s0determining hypervisor product name via dmi datassystem-product-names-system-product-name not available in dmi datasdetected hypervisor as %st
cloudsigma(tLOGtdebugRt
read_dmi_datatFalsetlower(R
tsys_product_name((sJ/usr/lib/python2.7/site-packages/cloudinit/sources/DataSourceCloudSigma.pytis_running_in_cloudsigma"s

cCs d}|j�stSy |jj�j}|d}Wntk
rWtjd�tSX|j	|j
d�g�|_|tj
kr�tS|j
dd�jd�}|j
dd�|_d|kr�t|j�|_nd|j
d	i�kr|d	d|_n||_|d
|_tS(sj
        Metadata is the whole server context and /meta/cloud-config is used
        as userdata.
        tmetas+CloudSigma: Unable to read from serial portscloudinit-dsmodet
base64_fieldsRt,scloudinit-user-datat	cloudinittvendor_dataR
N(tNoneRRR	talltresultt	ExceptionRRt_determine_dsmodetgettdsmodeRtDSMODE_DISABLEDtsplittuserdata_rawRtvendordata_rawtmetadataR
tTrue(R
R$tserver_contexttserver_metaR((sJ/usr/lib/python2.7/site-packages/cloudinit/sources/DataSourceCloudSigma.pyt	_get_data0s,

	
cCsdtS(s/Return the subplatform metadata source details.s
cepko (%s)(R(R
((sJ/usr/lib/python2.7/site-packages/cloudinit/sources/DataSourceCloudSigma.pyt_get_subplatformSscCsDtjd|jd�r(|jdd S|jdjd�dSdS(s�
        Cleans up and uses the server's name if the latter is set. Otherwise
        the first part from uuid is being used.
        s^[A-Za-z0-9 -_\.]+$tnamei=tuuidt-iN(tretmatchR)R&(R
tfqdnt
resolve_ipt
metadata_only((sJ/usr/lib/python2.7/site-packages/cloudinit/sources/DataSourceCloudSigma.pytget_hostnameWscCs
|jgS(N(R
(R
((sJ/usr/lib/python2.7/site-packages/cloudinit/sources/DataSourceCloudSigma.pytget_public_ssh_keysascCs|jdS(NR0(R)(R
((sJ/usr/lib/python2.7/site-packages/cloudinit/sources/DataSourceCloudSigma.pytget_instance_idds(t__name__t
__module__t__doc__tdsnameRRR-R.RR7R8R9(((sJ/usr/lib/python2.7/site-packages/cloudinit/sources/DataSourceCloudSigma.pyRs			#	
	cCstj|t�S(sK
    Return a list of data sources that match this set of dependencies
    (Rtlist_from_dependstdatasources(tdepends((sJ/usr/lib/python2.7/site-packages/cloudinit/sources/DataSourceCloudSigma.pytget_datasource_listrs(tbase64RR2tcloudinit.cs_utilsRRRRtloggingRRt	getLoggerR:RRRtDataSourceCloudSigmaNettDEP_FILESYSTEMR?RA(((sJ/usr/lib/python2.7/site-packages/cloudinit/sources/DataSourceCloudSigma.pyt<module>sV