def FindAllAvailableBrowsers(finder_options):
    """Finds all available chromeos browsers, locally and remotely."""
    if cros_interface.IsRunningOnCrosDevice():
        return [
            PossibleCrOSBrowser('system',
                                finder_options,
                                cros_interface.CrOSInterface(),
                                is_guest=False),
            PossibleCrOSBrowser('system-guest',
                                finder_options,
                                cros_interface.CrOSInterface(),
                                is_guest=True)
        ]

    if finder_options.cros_remote == None:
        logging.debug('No --remote specified, will not probe for CrOS.')
        return []

    if not cros_interface.HasSSH():
        logging.debug('ssh not found. Cannot talk to CrOS devices.')
        return []
    cri = cros_interface.CrOSInterface(finder_options.cros_remote,
                                       finder_options.cros_ssh_identity)

    # Check ssh
    try:
        cri.TryLogin()
    except cros_interface.LoginException, ex:
        if isinstance(ex, cros_interface.KeylessLoginRequiredException):
            logging.warn(
                'Could not ssh into %s. Your device must be configured',
                finder_options.cros_remote)
            logging.warn('to allow passwordless login as root.')
            logging.warn('For a test-build device, pass this to your script:')
            logging.warn('   --identity $(CHROMITE)/ssh_keys/testing_rsa')
            logging.warn('')
            logging.warn('For a developer-mode device, the steps are:')
            logging.warn(
                ' - Ensure you have an id_rsa.pub (etc) on this computer')
            logging.warn(' - On the chromebook:')
            logging.warn('   -  Control-Alt-T; shell; sudo -s')
            logging.warn('   -  openssh-server start')
            logging.warn('   -  scp <this machine>:.ssh/id_rsa.pub /tmp/')
            logging.warn('   -  mkdir /root/.ssh')
            logging.warn('   -  chown go-rx /root/.ssh')
            logging.warn(
                '   -  cat /tmp/id_rsa.pub >> /root/.ssh/authorized_keys')
            logging.warn('   -  chown 0600 /root/.ssh/authorized_keys')
            logging.warn('There, that was easy!')
            logging.warn('')
            logging.warn('P.S. Please, tell your manager how INANE this is.')

        from telemetry.core import browser_finder
        raise browser_finder.BrowserFinderException(str(ex))
def CanFindAvailableBrowsers(finder_options):
    return (cros_interface.IsRunningOnCrosDevice()
            or finder_options.cros_remote or cros_interface.HasSSH())