%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /lib/python3/dist-packages/cloudinit/sources/__pycache__/
Upload File :
Create Path :
Current File : //lib/python3/dist-packages/cloudinit/sources/__pycache__/DataSourceCloudSigma.cpython-312.pyc

�

�ft����ddlZddlZddlmZddlmZmZddlmZddl	m
Z
mZeje
�ZGd�dej�ZeZeej$ffgZd�Zy)	�N)�	b64decode)�dmi�sources)�DataSourceHostname)�SERIAL_PORT�Cepkoc�J�eZdZdZdZd�Zed��Zd�Zd�Z	dd�Z
d�Zd	�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
    �
CloudSigmac�t�t�|_d|_tjj||||�y)N�)r�cepko�ssh_public_keyr�
DataSource�__init__)�self�sys_cfg�distro�pathss    �H/usr/lib/python3/dist-packages/cloudinit/sources/DataSourceCloudSigma.pyrzDataSourceCloudSigma.__init__s-���W��
� ������#�#�D�'�6�5�A�c���tjd�tjd�}|stjd�ytjd|�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)�LOG�debugr�
read_dmi_data�lower)�sys_product_names r�	ds_detectzDataSourceCloudSigma.ds_detect!s[��	�	�	�D�E��,�,�-B�C����I�I�E�F���	�	�-�/?�@��/�5�5�7�7�7rc�(�d}	|jj�j}|d}|j
|jd�g�|_|tjk(ry|jdd�jd�}|jd	d�|_d	|vrt|j�|_d
|jdi�vr
|dd
|_||_|d|_y
#t$rtjd�YywxYw)zj
        Metadata is the whole server context and /meta/cloud-config is used
        as userdata.
        N�metaz+CloudSigma: Unable to read from serial portFzcloudinit-dsmode�
base64_fieldsr
�,zcloudinit-user-data�	cloudinit�vendor_datarT)r�all�result�	Exceptionrr�_determine_dsmode�get�dsmoder�DSMODE_DISABLED�split�userdata_rawr�vendordata_raw�metadatar)rr+�server_context�server_metar"s     r�	_get_datazDataSourceCloudSigma._get_data0s��
��	�!�Z�Z�^�^�-�4�4�N�(��0�K��,�,�
�_�_�/�
0�1�
����W�,�,�,��#�����<�B�B�3�G�
�'�O�O�,A�2�F��� �M�1� )�$�*;�*;� <�D���.�,�,�]�B�?�?�"0��"?��"L�D��&��
�)�*:�;�����-�	�
�I�I�C�D��		�s�)C0�0D�Dc��dtzS)z/Return the subplatform metadata source details.z
cepko (%s))r�rs r�_get_subplatformz%DataSourceCloudSigma._get_subplatformRs
���k�)�)rc���tjd|jd�r|jddd}n!|jdjd�d}t	|d�S)	z�
        Cleans up and uses the server's name if the latter is set. Otherwise
        the first part from uuid is being used.
        z^[A-Za-z0-9 -_\.]+$�nameN�=�uuid�-rF)�re�matchr0r-r)r�fqdn�
resolve_ip�
metadata_only�rets     r�get_hostnamez!DataSourceCloudSigma.get_hostnameVs\��
�8�8�*�D�M�M�&�,A�B��-�-��'���,�C��-�-��'�-�-�c�2�1�5�C�!�#�u�-�-rc��|jgS)N)rr5s r�get_public_ssh_keysz(DataSourceCloudSigma.get_public_ssh_keysas���#�#�$�$rc� �|jdS)Nr:)r0r5s r�get_instance_idz$DataSourceCloudSigma.get_instance_idds���}�}�V�$�$rN)FFF)
�__name__�
__module__�__qualname__�__doc__�dsnamer�staticmethodrr3r6rBrDrF�rrr
r
sB����F�B�
�8��8� �D*�	.�%�%rr
c�6�tj|t�S)zK
    Return a list of data sources that match this set of dependencies
    )r�list_from_depends�datasources)�dependss r�get_datasource_listrRrs���$�$�W�k�:�:r)�loggingr<�base64rr$rr�cloudinit.sourcesr�$cloudinit.sources.helpers.cloudsigmarr�	getLoggerrGrrr
�DataSourceCloudSigmaNet�DEP_FILESYSTEMrPrRrMrr�<module>rZsg���	��"�0�C��g����!��S%�7�-�-�S%�n/��
�G�2�2�4�5���
;r

Zerion Mini Shell 1.0