diff options
author | David Pursell <dpursell@chromium.org> | 2015-07-07 14:17:52 -0700 |
---|---|---|
committer | ChromeOS Commit Bot <chromeos-commit-bot@chromium.org> | 2015-07-08 19:34:01 +0000 |
commit | 2891bb50fc2963ddc95ed6053539216330123b97 (patch) | |
tree | 6b9181e296885e0a8e662a5fb7dce76d12ca650e /cli | |
parent | c12586e9017c03866d25be2a9ae70da5e89de2c8 (diff) | |
download | chromite-2891bb50fc2963ddc95ed6053539216330123b97.tar.gz |
chromite: Remove debug link code.
We are no longer using the debug link, this CL removes all the code
implementing it.
BUG=chromium:507323
TEST=cbuildbot/run_tests
TEST=cros shell 100.107.3.72
TEST=cros deploy 100.107.3.72 debugd
TEST=cros flash 100.107.3.72
Change-Id: If46ca50f199f62e8d9d585eb8e2ea24f609f8c83
Reviewed-on: https://chromium-review.googlesource.com/283939
Reviewed-by: David Pursell <dpursell@chromium.org>
Commit-Queue: David Pursell <dpursell@chromium.org>
Trybot-Ready: David Pursell <dpursell@chromium.org>
Tested-by: David Pursell <dpursell@chromium.org>
Diffstat (limited to 'cli')
-rw-r--r-- | cli/cros/cros_shell.py | 15 | ||||
-rw-r--r-- | cli/cros/cros_shell_unittest.py | 12 |
2 files changed, 5 insertions, 22 deletions
diff --git a/cli/cros/cros_shell.py b/cli/cros/cros_shell.py index b5c29f22e..4664696e0 100644 --- a/cli/cros/cros_shell.py +++ b/cli/cros/cros_shell.py @@ -81,18 +81,16 @@ Quoting can be tricky; the rules are the same as with ssh: help='SSH identify file (private key).') parser.add_argument( '--no-known-hosts', action='store_false', dest='known_hosts', - default=True, help='Do not use a known_hosts file; always set' - ' for USB connections.') + default=True, help='Do not use a known_hosts file.') parser.add_argument( 'command', nargs=argparse.REMAINDER, help='(optional) Command to execute on the device.') def _ReadOptions(self): """Processes options and set variables.""" - if self.options.device: - self.ssh_hostname = self.options.device.hostname - self.ssh_username = self.options.device.username - self.ssh_port = self.options.device.port + self.ssh_hostname = self.options.device.hostname + self.ssh_username = self.options.device.username + self.ssh_port = self.options.device.port self.ssh_private_key = self.options.private_key self.known_hosts = self.options.known_hosts # By default ask the user if a new key is found. SSH will still reject @@ -106,10 +104,7 @@ Quoting can be tricky; the rules are the same as with ssh: def _ConnectSettings(self): """Generates the correct SSH connect settings based on our state.""" kwargs = {'NumberOfPasswordPrompts': 2} - # USB has no risk of a man-in-the-middle attack so we can turn off - # known_hosts for any USB connection. - if (self.known_hosts and - self.device.connection_type != remote_access.CONNECTION_TYPE_USB): + if self.known_hosts: # Use the default known_hosts and our current key check setting. kwargs['UserKnownHostsFile'] = None kwargs['StrictHostKeyChecking'] = self.host_key_checking diff --git a/cli/cros/cros_shell_unittest.py b/cli/cros/cros_shell_unittest.py index c6b77b0e5..e09ccd3e8 100644 --- a/cli/cros/cros_shell_unittest.py +++ b/cli/cros/cros_shell_unittest.py @@ -151,15 +151,3 @@ class ShellTest(cros_test_lib.MockTempDirTestCase, self.assertFalse(self.mock_prompt.called) self.assertEqual(self.mock_base_run_command.call_count, 1) self.assertFalse(self.mock_remove_known_host.called) - - def testUsbConnectionDoesNotUseKnownHosts(self): - """Tests that known_hosts is disabled by default for USB connections.""" - self.SetupCommandMock([self.DEVICE_IP]) - self.mock_device.connection_type = remote_access.CONNECTION_TYPE_USB - mock_compile_ssh_connect_settings = self.PatchObject( - remote_access, 'CompileSSHConnectSettings', autospec=True) - - self.cmd_mock.inst.Run() - - self.assertNotIn('UserKnownHostsFile', - mock_compile_ssh_connect_settings.call_args[-1]) |