MCPcopy Index your code
hub / github.com/aws/aws-cli / _run_main_command

Method _run_main_command

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

Source from the content-addressed store, hash-verified

172 ]
173
174 def _run_main_command(self, parsed_args, parsed_globals):
175 master_dns = sshutils.validate_and_find_master_dns(
176 session=self._session,
177 parsed_globals=parsed_globals,
178 cluster_id=parsed_args.cluster_id,
179 )
180
181 key_file = parsed_args.key_pair_file
182 sshutils.validate_ssh_with_key_file(key_file)
183 f = tempfile.NamedTemporaryFile(delete=False)
184 if emrutils.which('ssh') or emrutils.which('ssh.exe'):
185 ssh_options = _build_ssh_options(parsed_args.ssh_options)
186 command = ['ssh'] + ssh_options + [
187 '-o', 'ServerAliveInterval=10',
188 '-i', parsed_args.key_pair_file,
189 constants.SSH_USER + '@' + master_dns,
190 '-t',
191 ]
192 if parsed_args.command:
193 command.append(parsed_args.command)
194 else:
195 if parsed_args.ssh_options:
196 sys.stderr.write(PUTTY_SSH_OPTIONS_MSG)
197 command = [
198 'putty', '-ssh', '-i', parsed_args.key_pair_file,
199 constants.SSH_USER + '@' + master_dns, '-t',
200 ]
201 if parsed_args.command:
202 f.write(parsed_args.command)
203 f.write('\nread -n1 -r -p "Command completed. Press any key."')
204 command.append('-m')
205 command.append(f.name)
206
207 f.close()
208 print(' '.join(command))
209 rc = subprocess.call(command)
210 os.remove(f.name)
211 return rc
212
213
214class Put(Command):

Callers

nothing calls this directly

Calls 5

_build_ssh_optionsFunction · 0.85
writeMethod · 0.45
closeMethod · 0.45
callMethod · 0.45
removeMethod · 0.45

Tested by

no test coverage detected