HEX
Server: LiteSpeed
System: Linux s1049.use1.mysecurecloudhost.com 4.18.0-477.27.2.lve.el8.x86_64 #1 SMP Wed Oct 11 12:32:56 UTC 2023 x86_64
User: xedaptot (3356)
PHP: 8.3.31
Disabled: NONE
Upload Files
File: //lib/python3.6/site-packages/awscli/customizations/emr/__pycache__/ssh.cpython-36.pyc
3

�T_3�@s�ddlZddlZddlZddlmZddlmZddlmZddlmZdZ	Gdd�de�Z
Gd	d
�d
e�ZGdd�de�ZGd
d�de�Z
dS)�N)�	constants)�emrutils)�sshutils)�Commandz�
A value for the variable Key Pair File can be set in the AWS CLI config file using the "aws configure set emr.key_pair_file <value>" command.
c@s8eZdZdZdeZdddd�dddd�gZd	d
�ZdS)�SocksZsockszFCreate a socks tunnel on port 8157 from your machine to the master.
%sz
cluster-idTz*Cluster Id of cluster you want to ssh into)�name�required�	help_textz
key-pair-filez!Private key file to use for logincCs�y�tj|j||jd�}|j}tj|�tjdd�}tj	d�sFtj	d�rldddddd	d
d|jt
jd|g
}n d
dd|jt
jd|ddd
g}tdj
|��tj|�}|Stk
r�td�dSXdS)N)�session�parsed_globals�
cluster_idF)�delete�sshzssh.exez-ozStrictHostKeyChecking=nozServerAliveInterval=10z-NDZ8157z-i�@�puttyz-sshz-Nz-D� zDisabling Socks Tunnel.r)r�validate_and_find_master_dns�_sessionr�
key_pair_file�validate_ssh_with_key_file�tempfile�NamedTemporaryFiler�whichr�SSH_USER�print�join�
subprocess�call�KeyboardInterrupt)�self�parsed_argsr�
master_dns�key_file�f�command�rc�r&�/usr/lib/python3.6/ssh.py�_run_main_command's,



zSocks._run_main_commandN)�__name__�
__module__�__qualname__�NAME�KEY_PAIR_FILE_HELP_TEXT�DESCRIPTION�	ARG_TABLEr(r&r&r&r'rs
rc@s@eZdZdZdeZdddd�dddd�d	d
d�gZdd
�ZdS)�SSHrz'SSH into master node of the cluster.
%sz
cluster-idTz*Cluster Id of cluster you want to ssh into)rrr	z
key-pair-filez!Private key file to use for loginr$z!Command to execute on Master Node)rr	c	Cs�tj|j||jd�}|j}tj|�tjdd�}tj	d�sDtj	d�rzdddddd	|jt
jd
|dg	}|jr�|j
|j�nNdd
d	|jt
jd
|dg}|jr�|j|j�|jd�|j
d�|j
|j�|j�tdj|��tj|�}tj|j�|S)N)r
rrF)r
rzssh.exez-ozStrictHostKeyChecking=nozServerAliveInterval=10z-irz-trz-sshz3
read -n1 -r -p "Command completed. Press any key."z-mr)rrrrrrrrrrrrr$�append�writer�closerrrr�os�remove)rr rr!r"r#r$r%r&r&r'r(Os4





zSSH._run_main_commandN)r)r*r+r,r-r.r/r(r&r&r&r'r0Csr0c@sJeZdZdZdeZdddd�dddd�d	dd
d�ddd
�gZdd�ZdS)�PutZputz!Put file onto the master node.
%sz
cluster-idTz/Cluster Id of cluster you want to put file onto)rrr	z
key-pair-filez!Private key file to use for login�srcz!Source file path on local machine�destz$Destination file path on remote host)rr	cCs�tj|j||jd�}|j}tj|�tjd�s8tjd�rZdddd|j|jt	j
d|g}n dd	dd|j|jt	j
d|g}|jr�|dd|j|d<n |dd|jjd�d|d<t
d
j|��tj|�}|S)N)r
rr�scpzscp.exez-rz-o StrictHostKeyChecking=noz-ir�pscpz-scp��:�/r���r>r>r>r>)rrrrr�validate_scp_with_key_filerrr7rrr8�splitrrrr)rr rr!r"r$r%r&r&r'r(}s$


 
zPut._run_main_commandN)r)r*r+r,r-r.r/r(r&r&r&r'r6osr6c@sJeZdZdZdeZdddd�dddd�d	dd
d�ddd
�gZdd�ZdS)�Get�getzGet file from master node.
%sz
cluster-idTz/Cluster Id of cluster you want to get file from)rrr	z
key-pair-filez!Private key file to use for loginr7zSource file path on remote hostr8z%Destination file path on your machine)rr	cCs�tj|j||jd�}|j}tj|�tjd�s8tjd�r`dddd|jtj	d|d|j
g}n&d	d
dd|jtj	d|d|j
g}|jr�|j|j�n|j|j
j
d�d�td
j|��tj|�}|S)N)r
rrr9zscp.exez-rz-o StrictHostKeyChecking=noz-irr<r:z-scpr=r;rr>)rrrrrr?rrrrr7r8r1r@rrrr)rr rr!r"r$r%r&r&r'r(�s&



zGet._run_main_commandN)r)r*r+r,r-r.r/r(r&r&r&r'rA�srA)r4rrZawscli.customizations.emrrrrZ!awscli.customizations.emr.commandrr-rr0r6rAr&r&r&r'�<module>s',(