MCPcopy Create free account
hub / github.com/aws/aws-cli / _run_main_command

Method _run_main_command

awscli/customizations/emr/ssh.py:114–147  ·  view source on GitHub ↗
(self, parsed_args, parsed_globals)

Source from the content-addressed store, hash-verified

112 ]
113
114 def _run_main_command(self, parsed_args, parsed_globals):
115 try:
116 master_dns = sshutils.validate_and_find_master_dns(
117 session=self._session,
118 parsed_globals=parsed_globals,
119 cluster_id=parsed_args.cluster_id,
120 )
121
122 key_file = parsed_args.key_pair_file
123 sshutils.validate_ssh_with_key_file(key_file)
124 f = tempfile.NamedTemporaryFile(delete=False)
125 if emrutils.which('ssh') or emrutils.which('ssh.exe'):
126 ssh_options = _build_ssh_options(parsed_args.ssh_options)
127 command = ['ssh'] + ssh_options + [
128 '-o', 'ServerAliveInterval=10',
129 '-ND', '8157',
130 '-i', parsed_args.key_pair_file,
131 constants.SSH_USER + '@' + master_dns,
132 ]
133 else:
134 if parsed_args.ssh_options:
135 sys.stderr.write(PUTTY_SSH_OPTIONS_MSG)
136 command = [
137 'putty', '-ssh', '-i', parsed_args.key_pair_file,
138 constants.SSH_USER + '@' + master_dns,
139 '-N', '-D', '8157',
140 ]
141
142 print(' '.join(command))
143 rc = subprocess.call(command)
144 return rc
145 except KeyboardInterrupt:
146 print('Disabling Socks Tunnel.')
147 return 0
148
149
150class SSH(Command):

Callers

nothing calls this directly

Calls 3

_build_ssh_optionsFunction · 0.85
writeMethod · 0.45
callMethod · 0.45

Tested by

no test coverage detected