%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /lib/python3/dist-packages/sos/collector/transports/__pycache__/
Upload File :
Create Path :
Current File : //lib/python3/dist-packages/sos/collector/transports/__pycache__/juju.cpython-312.pyc

�

i��d�
��F�ddlZddlmZddlmZddlmZGd�de�Zy)�N)�JujuNotInstalledException)�RemoteTransport)�sos_get_command_outputc�X�eZdZdZdZdZd�Zd�Zdd�Zd�Z	e
d��Ze
d	��Zd
�Z
y)
�JujuSSHa
    A "transport" that leverages `juju ssh` to perform commands on the remote
    hosts.

    This transport is expected to be used in juju managed environment, and the
    user should have the necessary credential for accessing the controller.
    When using this transport, the --nodes option will be expected to be a
    comma separated machine IDs, **not** IP addr, since `juju ssh` identifies
    the ssh target by machine ID.

    Examples:

    sos collect --nodes 0,1,2 --no-local --transport juju --batch

    �juju_ssh�ubuntuc��d}	tj|tjd��y#tj$r|j	d�t
�wxYw)Nzjuju versionT��stderr�shellzFailed to check `juju` version)�
subprocess�check_output�STDOUT�CalledProcessError�	log_errorr)�self�cmds  �?/usr/lib/python3/dist-packages/sos/collector/transports/juju.py�_check_juju_installedzJujuSSH._check_juju_installed'sS����	,��#�#�C�
�0A�0A��N����,�,�	,��N�N�;�<�+�+�	,�s	�&+�+Ac���|j�d|��}	tj|tjd��y#tj$r|jd|�d���wxYw)Nz sudo chmod o+r TrzFailed to make z world-readable)�remote_execrrrrr)r�fnamers   r�_chmodzJujuSSH._chmod0sk���!�!�"�"2�5�'�:��	��#�#�C�
�0A�0A��N����,�,�	��N�N�_�U�G�?�C�D��	�s	�&:�*A$c�D�|j�|_|jS�N)r�
_connected)r�passwords  r�_connectzJujuSSH._connect9s���4�4�6�������c��y)NT��rs r�_disconnectzJujuSSH._disconnect=s��r c��|jSr)rr#s r�	connectedzJujuSSH.connected@s�����r c�h�|jjd�\}}|rd|��nd}|�d|��}d|��S)N�:�-m �� z	juju ssh )�address�split)r�model�
target_option�model_option�options     rrzJujuSSH.remote_execDsG��#�|�|�1�1�#�6���}�(-��U�G�}�2�� �>��=�/�2���6�(�#�#r c��|j|�|jjd�\}}|rd|��nd}d|�d|�d|�d|��}t|�}|ddk(S)	Nr(r)r*z	juju scp z -- -r r+�statusr)rr,r-r)rr�destr.�unitr0r�ress        r�_retrieve_filezJujuSSH._retrieve_fileKsl�����E���l�l�(�(��-���t�(-��U�G�}�2���,��w�t�f�A�e�W�A�d�V�D��$�S�)���8�}��!�!r N)r*)�__name__�
__module__�__qualname__�__doc__�name�default_userrrrr$�propertyr&rr7r"r rrrsT��� �D��L����������$��$�"r r)r�sos.collector.exceptionsr�sos.collector.transportsr�
sos.utilitiesrrr"r r�<module>rBs���>�4�0�>"�o�>"r 

Zerion Mini Shell 1.0