Python fabric.api.env 模块,disable_known_hosts() 实例源码

我们从Python开源项目中,提取了以下4个代码示例,用于说明如何使用fabric.api.env.disable_known_hosts()

项目:dprr-django    作者:kingsdigitallab    | 项目源码 | 文件源码
def vagrant():
    env.srvr = 'vagrant'
    env.path = os.path.join('/', env.srvr)

    # this is necessary because ssh will fail when known hosts keys vary
    # every time vagrant is destroyed, a new key will be generated
    env.disable_known_hosts = True

    env.within_virtualenv = 'source {}'.format(
        os.path.join('~', 'venv', 'bin', 'activate'))

    result = dict(line.split()
                  for line in local('vagrant ssh-config',
                                    capture=True).splitlines())

    env.hosts = ['%s:%s' % (result['HostName'], result['Port'])]
    env.key_filename = result['IdentityFile']
    env.user = result['User']

    print(env.key_filename, env.hosts, env.user)
项目:osc_cloud_builder    作者:outscale    | 项目源码 | 文件源码
def connect_to_instance_in_ssh(address, keypair_path, user='root'):
    """
    Run the command LS on a given instance
    :param address: ip or dns name of a machine
    :type address: str
    :param keypair_path: keypair path
    :type keypair_path: str
    """

    env.host_string = address
    env.user = user
    env.parallel = False
    env.key_filename = keypair_path
    env.disable_known_hosts = True
    env.connection_attempts = 10
    env.timeout = 120

    ocb.log(run('ls -la /root'), level='INFO')
项目:astoptool    作者:zouliuyun    | 项目源码 | 文件源码
def set_fabric_common_env():
    """
    ??????????fabric env
    """
    env.user = 'astd'
    env.use_ssh_config = True   # This is important when running under root.
    env.connection_attempts = 5
    env.disable_known_hosts = True
    env.keepalive = 60
项目:docker-django-webpack-skeleton    作者:phpdude    | 项目源码 | 文件源码
def _production_env():
    # Speedup connection setup to server.
    env.disable_known_hosts = True

    env.key_filename = [os.path.join(os.environ['HOME'], '.ssh', 'id_rsa')]
    env.project_root = '~/app/'