https://t.me/RX1948
Server : LiteSpeed
System : Linux host 5.15.0-161-generic #171-Ubuntu SMP Sat Oct 11 08:17:01 UTC 2025 x86_64
User : idnco5810 ( 1093)
PHP Version : 8.2.29
Disable Function : NONE
Directory :  /lib/python3/dist-packages/sos/collector/transports/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : //lib/python3/dist-packages/sos/collector/transports/__pycache__/juju.cpython-310.pyc
o

([Qh�@s@ddlZddlmZddlmZddlmZGdd�de�ZdS)�N)�JujuNotInstalledException)�RemoteTransport)�sos_get_command_outputc@sbeZdZdZdZdZdd�Zdd�Zdd	d
�Zdd�Z	e
d
d��Ze
dd��Zdd�Z
dd�ZdS)�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
CsHd}ztj|tjdd�WdStjy#}z|�d�t|�d}~ww)Nzjuju versionT��stderr�shellzFailed to check `juju` version)�
subprocess�check_output�STDOUT�CalledProcessError�	log_errorr)�self�cmd�err�r�?/usr/lib/python3/dist-packages/sos/collector/transports/juju.py�_check_juju_installed's�
��zJujuSSH._check_juju_installedcCsN|j�d|��}ztj|tjdd�WdStjy&|�d|�d���w)Nz sudo chmod o+r TrzFailed to make z world-readable)�remote_execrrr
rr)r�fnamerrrr�_chmod0s��zJujuSSH._chmod�cCs|��|_|jS�N)r�
_connected)r�passwordrrr�_connect9s
zJujuSSH._connectcCsdS)NTr�rrrr�_disconnect=szJujuSSH._disconnectcCs|jSr)rrrrr�	connected@szJujuSSH.connectedcCs:|j�d�\}}|rd|��nd}|�d|��}d|��S)N�:�-m r� z	juju ssh )�address�split)r�model�
target_option�model_option�optionrrrrDs
zJujuSSH.remote_execcCsV|j�d�\}}|rd|��nd}d|�d|�d|�d|��}t|dd�}|d	d
kS)Nr!r"r�	juju scp z -- r#�)�timeout�statusr)r$r%r�rr�destr&�unitr(r�resrrr�_copy_file_to_remoteKs
zJujuSSH._copy_file_to_remotecCs\|�|�|j�d�\}}|rd|��nd}d|�d|�d|�d|��}t|�}|ddkS)	Nr!r"rr*z -- -r r#r-r)rr$r%rr.rrr�_retrieve_fileRs
zJujuSSH._retrieve_fileN)r)�__name__�
__module__�__qualname__�__doc__�name�default_userrrrr�propertyr rr2r3rrrrrs	
	

r)r�sos.collector.exceptionsr�sos.collector.transportsr�
sos.utilitiesrrrrrr�<module>s


https://t.me/RX1948 - 2025