def _passwd_opts(self):
        '''
        Return options to pass to ssh
        '''
        # TODO ControlMaster does not work without ControlPath
        # user could take advantage of it if they set ControlPath in their
        # ssh config.  Also, ControlPersist not widely available.
        options = ['ControlMaster=auto',
                   'StrictHostKeyChecking=no',
                   ]
        if self.opts['_ssh_version'] > (4, 9):
            options.append('GSSAPIAuthentication=no')
        options.append('ConnectTimeout={0}'.format(self.timeout))
        if self.opts.get('ignore_host_keys'):
            options.append('StrictHostKeyChecking=no')
        if self.opts.get('no_host_keys'):
            options.extend(['StrictHostKeyChecking=no',
                            'UserKnownHostsFile=/dev/null'])

        if self.passwd:
            options.extend(['PasswordAuthentication=yes',
                            'PubkeyAuthentication=yes'])
        else:
            options.extend(['PasswordAuthentication=no',
                            'PubkeyAuthentication=yes',
                            'KbdInteractiveAuthentication=no',
                            'ChallengeResponseAuthentication=no',
                            'BatchMode=yes'])
        if self.port:
            options.append('Port={0}'.format(self.port))
        if self.user:
            options.append('User={0}'.format(self.user))
        if self.identities_only:
            options.append('IdentitiesOnly=yes')

        ret = []
        for option in options:
            ret.append('-o {0} '.format(option))
        return ''.join(ret)
def _passwd_opts ( self ) : options = [ 'ControlMaster=auto' , 'StrictHostKeyChecking=no' , ] if self . opts [ '_ssh_version' ] > ( 4 , 9 ) : options . append ( 'GSSAPIAuthentication=no' ) options . append ( 'ConnectTimeout={0}' . format ( self . timeout ) ) if self . opts . get ( 'ignore_host_keys' ) : options . append ( 'StrictHostKeyChecking=no' ) if self . opts . get ( 'no_host_keys' ) : options . extend ( [ 'StrictHostKeyChecking=no' , 'UserKnownHostsFile=/dev/null' ] ) if self . passwd : options . extend ( [ 'PasswordAuthentication=yes' , 'PubkeyAuthentication=yes' ] ) else : options . extend ( [ 'PasswordAuthentication=no' , 'PubkeyAuthentication=yes' , 'KbdInteractiveAuthentication=no' , 'ChallengeResponseAuthentication=no' , 'BatchMode=yes' ] ) if self . port : options . append ( 'Port={0}' . format ( self . port ) ) if self . user : options . append ( 'User={0}' . format ( self . user ) ) if self . identities_only : options . append ( 'IdentitiesOnly=yes' ) ret = [ ] for option in options : ret . append ( '-o {0} ' . format ( option ) ) return '' . join ( ret )
Return options to pass to ssh