HEX
Server: Apache
System: Linux dinesh8189 5.15.98-grsec-sharedvalley-2.lc.el8.x86_64 #1 SMP Thu Mar 9 09:07:30 -03 2023 x86_64
User: cgmgerenciamento1 (814285)
PHP: 8.1.26
Disabled: apache_child_terminate,dl,escapeshellarg,escapeshellcmd,exec,link,mail,openlog,passthru,pcntl_alarm,pcntl_exec,pcntl_fork,pcntl_get_last_error,pcntl_getpriority,pcntl_setpriority,pcntl_signal,pcntl_signal_dispatch,pcntl_sigprocmask,pcntl_sigtimedwait,pcntl_sigwaitinfo,pcntl_strerror,pcntl_wait,pcntl_waitpid,pcntl_wexitstatus,pcntl_wifexited,pcntl_wifsignaled,pcntl_wifstopped,pcntl_wstopsig,pcntl_wtermsig,php_check_syntax,php_strip_whitespace,popen,proc_close,proc_open,shell_exec,symlink,system
Upload Files
File: //usr/lib/python3.6/site-packages/sos/collector/transports/__pycache__/juju.cpython-36.pyc
3

3��d�
�@s@ddlZddlmZddlmZddlmZGdd�de�ZdS)�N)�JujuNotInstalledException)�RemoteTransport)�sos_get_command_outputc@sZeZdZdZdZdZdd�Zdd�Zdd	d
�Zdd�Z	e
d
d��Ze
dd��Zdd�Z
dS)�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_sshZubuntucCsDd}ytj|tjdd�Wn$tjk
r>|jd�t�YnXdS)Nzjuju versionT)�stderr�shellzFailed to check `juju` version)�
subprocess�check_output�STDOUT�CalledProcessError�	log_errorr)�self�cmd�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_execcCs\|j|�|jjd�\}}|r(d|��nd}d|�d|�d|�d|��}t|�}|ddkS)	Nrz-m rz	juju scp z -- -r rZstatusr)rrrr)r
r�destrZunitrr�resrrr�_retrieve_fileKs
zJujuSSH._retrieve_fileN)r)�__name__�
__module__�__qualname__�__doc__�nameZdefault_userrrrr�propertyrrr"rrrrrs		
r)rZsos.collector.exceptionsrZsos.collector.transportsrZ
sos.utilitiesrrrrrr�<module>s