当前位置: 首页>>代码示例>>Python>>正文


Python env.key_filename方法代码示例

本文整理汇总了Python中fabric.api.env.key_filename方法的典型用法代码示例。如果您正苦于以下问题:Python env.key_filename方法的具体用法?Python env.key_filename怎么用?Python env.key_filename使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在fabric.api.env的用法示例。


在下文中一共展示了env.key_filename方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: configure_env

# 需要导入模块: from fabric.api import env [as 别名]
# 或者: from fabric.api.env import key_filename [as 别名]
def configure_env():
    ''' Configures the fabric env. '''
    config = get_config()
    stage = get_stage()
    stage_config = get_stage_config(stage)
    env.user = stage_config.get('user') or config['user']
    env.port = stage_config.get('port') or config['port']
    env.cwd = stage_config.get('cwd') or config['cwd']
    env.key_filename = stage_config.get(
        'key_filename') or config['key_filename']
    env.hosts = [stage_config['host']]
    ssh_forward_agent = stage_config.get(
        'ssh_forward_agent') or config['ssh_forward_agent']

    env.forward_agent = (
        ssh_forward_agent and
        str(ssh_forward_agent).lower() == 'true'
    )

    # If Verbose logging is turned on show verbose logs.
    verbose_logging = stage_config.get('verbose_logging') or config[
        'verbose_logging']

    if str(verbose_logging).lower() == 'true':
        set_verbose_logging() 
开发者ID:kabirbaidhya,项目名称:boss,代码行数:27,代码来源:init.py

示例2: _get_vagrant_connection

# 需要导入模块: from fabric.api import env [as 别名]
# 或者: from fabric.api.env import key_filename [as 别名]
def _get_vagrant_connection():
    local('vagrant up')
    result = local('vagrant ssh-config', capture=True)
    hostname = re.findall(r'HostName\s+([^\n]+)', result)[0]
    port = re.findall(r'Port\s+([^\n]+)', result)[0]
    env.hosts = ['%s:%s' % (hostname, port)]
    env.user = re.findall(r'User\s+([^\n]+)', result)[0]
    env.key_filename = re.findall(r'IdentityFile\s+([^\n]+)', result)[0].lstrip("\"").rstrip("\"") 
开发者ID:dhamaniasad,项目名称:crestify,代码行数:10,代码来源:fabfile.py

示例3: __init__

# 需要导入模块: from fabric.api import env [as 别名]
# 或者: from fabric.api.env import key_filename [as 别名]
def __init__(self, user=None, password=None, key_filename=None):
        self.user = user
        self.password = password
        self.key_filename = key_filename 
开发者ID:SatelliteQE,项目名称:automation-tools,代码行数:6,代码来源:capsule.py

示例4: passwords

# 需要导入模块: from fabric.api import env [as 别名]
# 或者: from fabric.api.env import key_filename [as 别名]
def passwords(self):
        """Return a dict in the format suited for Fabric usage in order to
        define passwords for hosts.
        """
        passwords = {}
        if self.server.password and not self.server.key_filename:
            passwords[self.server.host_string] = self.server.password
        for capsule in self.capsules:
            if capsule.password and not capsule.key_filename:
                passwords[capsule.host_string] = capsule.password
        return passwords 
开发者ID:SatelliteQE,项目名称:automation-tools,代码行数:13,代码来源:capsule.py

示例5: setup_capsules

# 需要导入模块: from fabric.api import env [as 别名]
# 或者: from fabric.api.env import key_filename [as 别名]
def setup_capsules(path):
    """Reads the configuration, create capsules and start content sync on
    them.
    """
    load_capsule_config(path)
    config = env.capsule_config
    server = config.server.host_string

    # Let Fabric know how to log into the hosts
    env.passwords = config.passwords
    env.key_filename = config.key_filenames

    # The oauth information is needed for every capsule register. Cache this
    # information.
    with settings(host_string=server):
        oauth_info = get_oauth_info()

    # Register each capsule on the server
    for capsule in config.capsules:
        with settings(host_string=server):
            cert_path = generate_capsule_certs(capsule.hostname)
            get(remote_path=cert_path, local_path=cert_path)

        with settings(host_string=capsule.host_string):
            register_capsule()
            put(local_path=cert_path)
            capsule_installer(capsule.hostname, cert_path, *oauth_info) 
开发者ID:SatelliteQE,项目名称:automation-tools,代码行数:29,代码来源:capsule.py

示例6: make_worker_ami

# 需要导入模块: from fabric.api import env [as 别名]
# 或者: from fabric.api.env import key_filename [as 别名]
def make_worker_ami(config, ec2, security_group_list):
    """ Sets up worker components, runs before jupyterhub setup, after common setup. """
    instance = launch_server(config, ec2, security_group_list, size=int(config.worker_ebs_size))
    instance.wait_until_exists()
    instance.wait_until_running()

    # Configure fabric
    env.host_string = instance.public_ip_address
    env.key_filename = KEY_PATH
    env.user = config.server_username

    # Wait for server to finish booting (keep trying until you can successfully run a command on the server via ssh)
    retry(run, "# waiting for ssh to be connectable...", max_retries=100)

    sudo("apt-get -qq -y update")

    sudo("apt-get -qq -y install -q python python-dev python-pip")
    sudo("pip install --upgrade pip")
    sudo("apt-get -qq -y remove -q python-pip")
    sudo("hash -r")

    sudo("apt-get -qq -y install -q python3-pip sqlite")
    sudo("pip3 install --upgrade pip")
    sudo("apt-get -qq -y remove -q python3-pip")
    sudo("hash -r")

    put("jupyterhub_files/requirements_jupyterhub.txt", remote_path="/var/tmp/")
    sudo("pip3 install --quiet -r /var/tmp/requirements_jupyterhub.txt")

    sudo("pip3 -q install ipython jupyter ipykernel nbgrader")
    sudo("pip2 -q install ipykernel --upgrade")

    # register Python 3 and 2 kernel
    sudo("python3 -m ipykernel install")
    sudo("python2 -m ipykernel install")
    sudo("chmod 755 /mnt")
    sudo("chown ubuntu /mnt")

    # Create AMI for workers
    logger.info("Creating worker AMI")
    ami_name = "jupyter-hub-%s-worker-image" % config.cluster_name
    worker_ami = instance.create_image(Name=ami_name)

    # Wait until AMI is ready or 300 seconds have elapsed to allow for server restart
    for i in range(100):
        if get_resource(config.region).Image(worker_ami.id).state == "available":
            break
        logger.info("AMI not ready yet (running for ~%s seconds)" % (i * 3))
        sleep(3)

    instance.terminate()
    return worker_ami.id

######################################################################################################################
################################################## AWS HELPERS #######################################################
###################################################################################################################### 
开发者ID:harvard,项目名称:cloudJHub,代码行数:58,代码来源:launch.py

示例7: _parse

# 需要导入模块: from fabric.api import env [as 别名]
# 或者: from fabric.api.env import key_filename [as 别名]
def _parse(self):
        """Parse the configuration and store the contents"""
        with open(self.path) as handler:
            data = json.load(handler)
        self.organization_label = data.get('organization-label')
        self.environment = data.get('environment')
        self.content_view = data.get('content-view')
        self.activation_key = data.get('activation-key')
        self.admin_user = data.get('admin-user')
        self.admin_password = data.get('admin-password')
        defaults = data.get('defaults')
        if defaults is not None and isinstance(defaults, dict):
            key_filename = defaults.get('key-filename')
            self._key_filenames.add(key_filename)
            self.defaults = Credentials(
                user=defaults.get('user'),
                password=defaults.get('password'),
                key_filename=key_filename,
            )
        server = data.get('server')
        if server is not None and isinstance(server, dict):
            key_filename = server.get('key-filename')
            self._key_filenames.add(key_filename)
            self.server = HostConfig(
                hostname=server.get('hostname'),
                user=server.get('user', self.defaults.user),
                password=server.get('password', self.defaults.password),
                key_filename=key_filename,
            )
        capsules = data.get('capsules')
        if capsules is not None and isinstance(capsules, list):
            for capsule in capsules:
                if capsule is not None and isinstance(capsule, dict):
                    key_filename = capsule.get('key-filename')
                    self._key_filenames.add(key_filename)
                    self.capsules.append(HostConfig(
                        hostname=capsule.get('hostname'),
                        user=capsule.get('user', self.defaults.user),
                        password=capsule.get(
                            'password', self.defaults.password),
                        key_filename=key_filename,
                    )) 
开发者ID:SatelliteQE,项目名称:automation-tools,代码行数:44,代码来源:capsule.py


注:本文中的fabric.api.env.key_filename方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。