/usr/lib/python3/dist-packages/sos/collector/transports/__pycache__
Edit: /usr/lib/python3/dist-packages/sos/collector/transports/__pycache__/juju.cpython-310.pyc (3124B)
o
G%@i @ s@ d dl Z d dlmZ d dlmZ d dlmZ G dd deZdS ) N)JujuNotInstalledException)RemoteTransport)sos_get_command_outputc @ sb e Zd ZdZdZdZdd Zdd Zdd d
Zdd Z e
d
d Ze
dd Zdd 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_sshubuntuc
C sH d}zt j|t jdd W dS t jy# } z| d t|d }~ww )Nzjuju versionTstderrshellzFailed to check `juju` version)
subprocesscheck_outputSTDOUTCalledProcessError log_errorr )selfcmderr r ?/usr/lib/python3/dist-packages/sos/collector/transports/juju.py_check_juju_installed' s
zJujuSSH._check_juju_installedc C sN | j d| }ztj|tjdd W dS tjy& | d| d w )Nz sudo chmod o+r Tr zFailed to make z world-readable)remote_execr r r
r r )r fnamer r r r _chmod0 s zJujuSSH._chmod c C s | | _| jS N)r
_connected)r passwordr r r _connect9 s
zJujuSSH._connectc C s dS )NTr r r r r _disconnect= s zJujuSSH._disconnectc C s | j S r )r r r r r connected@ s zJujuSSH.connectedc C s: | j d\}}|rd| nd}| d| }d| S )N:-m r z juju ssh )addresssplit)r model
target_optionmodel_optionoptionr r r r D s
zJujuSSH.remote_execc C sV | j d\}}|rd| nd}d| d| d| d| }t|dd}|d d
kS )Nr! r" r juju scp z -- r# )timeoutstatusr )r$ r% r r r destr&