當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。