NineSec Team Shell
Server IP : 184.107.3.203  /  Your IP : 216.73.216.51
Web Server : Apache
System : Linux dedicated2.avenfashion.com.ph 4.18.0-553.40.1.el8_10.x86_64 #1 SMP Mon Feb 10 12:11:18 EST 2025 x86_64
User : adminteladeoro ( 1015)
PHP Version : 8.2.28
Disable Function : exec,passthru,shell_exec,system
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : ON
Directory (0755) :  /usr/lib/python3.6/site-packages/sos/collector/transports/__pycache__/

[  Home  ][  C0mmand  ][  Upload File  ]

Current File : //usr/lib/python3.6/site-packages/sos/collector/transports/__pycache__/juju.cpython-36.pyc
3

~�g�@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

    Zjuju_sshZubuntucCsTd}ytj|tjdd�Wn4tjk
rN}z|jd�t|�WYdd}~XnXdS)Nzjuju versionT)�stderr�shellzFailed to check `juju` version)�
subprocess�check_output�STDOUT�CalledProcessError�	log_errorr)�self�cmd�err�r�/usr/lib/python3.6/juju.py�_check_juju_installed's
zJujuSSH._check_juju_installedcCsV|j�d|��}ytj|tjdd�Wn*tjk
rP|jd|�d���YnXdS)Nz sudo chmod o+r T)rrzFailed to make z world-readable)�remote_execrr	r
rr)r
�fnamerrrr�_chmod0szJujuSSH._chmod�cCs|j�|_|jS)N)r�
_connected)r
Zpasswordrrr�_connect9s
zJujuSSH._connectcCsdS)NTr)r
rrr�_disconnect=szJujuSSH._disconnectcCs|jS)N)r)r
rrr�	connected@szJujuSSH.connectedcCs:|jjd�\}}|rd|��nd}|�d|��}d|��S)N�:z-m r� z	juju ssh )�address�split)r
�modelZ
target_option�model_optionZoptionrrrrDszJujuSSH.remote_execcCsV|jjd�\}}|rd|��nd}d|�d|�d|�d|��}t|dd�}|d	d
kS)Nrz-m rz	juju scp z -- r�)Ztimeout�statusr)rrr)r
r�destr�unitr r�resrrr�_copy_file_to_remoteKs
zJujuSSH._copy_file_to_remotecCs\|j|�|jjd�\}}|r(d|��nd}d|�d|�d|�d|��}t|�}|ddkS)	Nrz-m rz	juju scp z -- -r rr"r)rrrr)r
rr#rr$r rr%rrr�_retrieve_fileRs
zJujuSSH._retrieve_fileN)r)�__name__�
__module__�__qualname__�__doc__�nameZdefault_userrrrr�propertyrrr&r'rrrrrs		
r)rZsos.collector.exceptionsrZsos.collector.transportsrZ
sos.utilitiesrrrrrr�<module>s

NineSec Team - 2022