File: //usr/lib/python3.6/site-packages/awscli/customizations/emr/__pycache__/ssh.cpython-36.pyc
3
�T_3 � @ s� d dl Z d dlZd dlZd dlmZ d dlmZ d dlmZ d dlmZ dZ G dd� de�Z
G d d
� d
e�ZG dd� de�ZG d
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 @ s8 e Zd ZdZde Zdddd�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 loginc C s� y�t j| j||jd�}|j}t j|� tjdd�}tj d�sFtj d�rldddddd d
d|jt
jd | g
}n d
dd|jt
jd | ddd
g}tdj
|�� tj|�}|S tk
r� td� dS X d S )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&