python类hosts()的实例源码

fabfile.py 文件源码 项目:djdeploy 作者: ntuwang 项目源码 文件源码 阅读 22 收藏 0 点赞 0 评论 0
def rsyncd(self, local_dest, remote_dest):
        local(
            "rsync --progress --delete -avzq --rsh=\"sshpass -p {ssh_pass} ssh -p 22 \" "
            "--exclude='assets/sass' --exclude='assets/js/app' "
            "--exclude='scripts' --exclude='node-modules' --exclude='WEB-INF' "
            "{local_dest}/ {ssh_user}@{ssh_host}:{remote_dest}".format(
                local_dest=local_dest,
                remote_dest=remote_dest,
                ssh_user=env.user,
                ssh_host=env.hosts,
                ssh_pass=env.password))
fabfile.py 文件源码 项目:startupintro 作者: ShubhamBansal1997 项目源码 文件源码 阅读 21 收藏 0 点赞 0 评论 0
def prod():
    env.host_group = 'production'
    env.remote = 'origin'
    env.branch = 'prod'
    env.hosts = ['prod.startupintro.com']
    env.dotenv_path = '/home/ubuntu/startupintro/.env'
    env.config_setter = fab.run
fabfile.py 文件源码 项目:startupintro 作者: ShubhamBansal1997 项目源码 文件源码 阅读 26 收藏 0 点赞 0 评论 0
def configure(tags='', skip_tags='deploy'):
    """Setup a host using ansible scripts

    Usages: fab [prod|qa|dev] configure
    """
    fab.require('host_group')
    cmd = 'ansible-playbook -i hosts site.yml --limit=%(host_group)s' % env
    with fab.lcd('provisioner'):
        if tags:
            cmd += " --tags '%s'" % tags
        if skip_tags:
            cmd += " --skip-tags '%s'" % skip_tags
        local(cmd)
fabfile.py 文件源码 项目:Simplechaindb 作者: BUAANLSDE 项目源码 文件源码 阅读 22 收藏 0 点赞 0 评论 0
def send_client_confile(confile):
    put(confile, 'tempfile')
    run('mv tempfile ~/.bigchaindb')
    print('For this node, bigchaindb show-config says:')
    run('simplechaindb show-config')


# Initialize BigchainDB
# i.e. create the database, the tables,
# the indexes, and the genesis block.
# (The @hosts decorator is used to make this
# task run on only one node. See http://tinyurl.com/h9qqf3t )
fabfile.py 文件源码 项目:Simplechaindb 作者: BUAANLSDE 项目源码 文件源码 阅读 20 收藏 0 点赞 0 评论 0
def  set_node(host,password):
    env['passwords'][host]=password
    env['hosts']=env['passwords'].keys()


###################
# Install Collectd
nova_compute_proxy.py 文件源码 项目:charm-nova-compute-proxy 作者: openstack 项目源码 文件源码 阅读 20 收藏 0 点赞 0 评论 0
def __init__(self, user, ssh_key, hosts,
                 repository, password):
        if None in [user, ssh_key, hosts, repository]:
            # XXX: Charm should block instead.
            #      https://bugs.launchpad.net/bugs/1638772
            raise Exception('Missing configuration')
        self.user = user
        self.ssh_key = ssh_key
        self.hosts = hosts.split()
        self.repository = repository
        self.password = password
        self.key_filename = self._write_key()
        self._init_fabric()
nova_compute_proxy.py 文件源码 项目:charm-nova-compute-proxy 作者: openstack 项目源码 文件源码 阅读 21 收藏 0 点赞 0 评论 0
def _init_fabric(self):
        env.warn_only = True
        env.connection_attempts = 10
        env.timeout = 10
        env.user = self.user
        env.key_filename = self.key_filename
        env.hosts = self.hosts
        env.password = self.password
07_04_install_python_package_remotely.py 文件源码 项目:011_python_network_programming_cookbook_demo 作者: jerry-0824 项目源码 文件源码 阅读 19 收藏 0 点赞 0 评论 0
def remote_server():
    env.hosts = ['127.0.0.1']
    env.user = prompt('Enter user name: ')
    env.password = getpass('Enter password: ')
07_06_transfer_file_over_ssh.py 文件源码 项目:011_python_network_programming_cookbook_demo 作者: jerry-0824 项目源码 文件源码 阅读 18 收藏 0 点赞 0 评论 0
def remote_server():
    env.hosts = ['127.0.0.1']
    env.password = getpass('Enter your system password: ')
    env.home_folder = '/tmp'
fabfile.py 文件源码 项目:flask-vue-semantic-docker 作者: italomaia 项目源码 文件源码 阅读 21 收藏 0 点赞 0 评论 0
def do_setup():
    """
    Helps you setup your environment. Call it once per project.
    """
    msg = "Command not found. Please, install %s"
    assert get_cmd_exists('npm'), msg % "npm"
    assert get_cmd_exists('vue'), msg % "vue-cli"
    assert get_cmd_exists('fab'), msg % "fabric3"
    assert get_cmd_exists('docker'), msg % "docker"
    assert get_cmd_exists('docker-compose'), msg % "docker-compose"

    print("Setting up VueJS (just accept defaults)")
    local('vue init webpack ux', shell='/bin/bash')

    print("Setting up SemanticUI (just accept defaults)")
    with lcd(STYLES_DIR):
        local('npm install semantic-ui', shell='/bin/bash')

        semantic_settings = os.path.join(STYLES_DIR, 'semantic.json')
        with open(semantic_settings, 'r') as fs:
            data = json.load(fs)

        data['autoInstall'] = True
        with open(semantic_settings, 'w') as fs:
            json.dump(data, fs)

    print(
        "IMPORTANT: run the following command:\n"
        "sudo echo \"127.0.0.1  dv\" >> /etc/hosts")

    print(
        "IMPORTANT: make sure to update your envfile file with "
        "your project production configuration.")
    print(
        "IMPORTANT: make sure to update your fabfile "
        "hosts with your production host.")
    print("")
    print("Now you're ready to go:")
    print('  fab env:dev up  # for development mode')
    print('  fab env:prd up  # for production mode')
    print('  fab env:tst up  # to simulate production mode')
    print('Locally, your project will be available at http://dv:8080')


问题


面经


文章

微信
公众号

扫码关注公众号