ftddlZddlZddlmZddlmZmZddlmZddl m Z m Z eje ZGddejZeZeej$ffgZdZy) N) b64decode)dmisources)DataSourceHostname) SERIAL_PORTCepkocJeZdZdZdZdZedZdZdZ d dZ dZ d Z y ) DataSourceCloudSigmaz 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 CloudSigmactt|_d|_tjj ||||y)N)rcepkossh_public_keyr DataSource__init__)selfsys_cfgdistropathss H/usr/lib/python3/dist-packages/cloudinit/sources/DataSourceCloudSigma.pyrzDataSourceCloudSigma.__init__s-W  ##D'65Actjdtjd}|stjdytjd|d|j vS)z Uses dmi data to detect if this instance of cloud-init is running in the CloudSigma's infrastructure. z0determining hypervisor product name via dmi datazsystem-product-namez-system-product-name not available in dmi dataFzdetected hypervisor as %s cloudsigma)LOGdebugr read_dmi_datalower)sys_product_names r ds_detectzDataSourceCloudSigma.ds_detect!s[ DE,,-BC IIE F -/?@/55777rc(d} |jjj}|d}|j |jdg|_|tjk(ry|jddjd}|jd d|_ d |vrt|j|_ d |jd ivr |d d |_||_|d |_y #t$rtj dYywxYw)zj Metadata is the whole server context and /meta/cloud-config is used as userdata. Nmetaz+CloudSigma: Unable to read from serial portFzcloudinit-dsmode base64_fieldsr ,zcloudinit-user-data cloudinit vendor_datarT)rallresult Exceptionrr_determine_dsmodegetdsmoderDSMODE_DISABLEDsplit userdata_rawrvendordata_rawmetadatar)rr+server_context server_metar"s r _get_datazDataSourceCloudSigma._get_data0s  !ZZ^^-44N(0K,, __/ 0 1   W,, ,#<BB3G 'OO,A2F M 1 )$*;*; rZsg "0Cg!S%7--S%n/ G2245 ;r