Python fabric.api.env 模块,use_ssh_config() 实例源码
我们从Python开源项目中,提取了以下4个代码示例,用于说明如何使用fabric.api.env.use_ssh_config()。
def set_env(config, version_tag=None):
"""
Fabric environmental variable setup
"""
# Bug: when setting this inside a function. Using host_string as workaround
config_dict = get_config(config)
env.hosts = [config_dict['HOST_NAME'], ]
env.host_string = config_dict['HOST_NAME']
env.project_name = config_dict['PROJECT_NAME']
env.project_dir = posixpath.join('/srv/images/', env.project_name)
env.use_ssh_config = True
env.image_name = config_dict['IMAGE'].split(':')[0]
env.base_image_name = env.image_name + '_base'
env.version_tag = version_tag
env.build_dir = '/srv/build'
env.local_path = os.path.dirname(__file__)
def set_env(config, version_tag=None):
"""
Fabric environmental variable setup
"""
# Bug: when setting this inside a function. Using host_string as workaround
config_dict = get_config(config)
env.hosts = [config_dict['HOST_NAME'], ]
env.host_string = config_dict['HOST_NAME']
env.project_name = config_dict['PROJECT_NAME']
env.project_dir = posixpath.join('/srv/images/', env.project_name)
env.use_ssh_config = True
env.image_name = config_dict['IMAGE'].split(':')[0]
env.base_image_name = env.image_name + '_base'
env.version_tag = version_tag
env.build_dir = '/srv/build'
env.local_path = os.path.dirname(__file__)
def proxy():
""" Use SOCKS proxy for ssh from dev servers """
env.ssh_config_path = "../client/ssh/proxy-config"
env.use_ssh_config = True