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__)
python类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 proxy():
""" Use SOCKS proxy for ssh from dev servers """
env.ssh_config_path = "../client/ssh/proxy-config"
env.use_ssh_config = True
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