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


Python colors.yellow方法代码示例

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


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

示例1: setup_environment

# 需要导入模块: from fabric import colors [as 别名]
# 或者: from fabric.colors import yellow [as 别名]
def setup_environment():
    """Create OCL directories and files.
    """
    for directory in ['/opt/virtualenvs', '/opt/deploy']:
        if not files.exists(directory):
            print yellow('Creating directory %s...' % directory)
            sudo('mkdir %s' % directory)
            sudo('chown deploy:deploy %s' % directory)

    # all logs go to /var/log/ocl subdirectories.
    if not files.exists('/var/log/ocl'):
        sudo('mkdir /var/log/ocl')
        sudo('chown deploy:deploy /var/log/ocl')

    # This backup dir is used by the current API server deployment
    # process.
    if not files.exists(BACKUP_DIR):
        sudo('mkdir -p %s' % BACKUP_DIR)
        sudo('chown deploy:deploy %s' % BACKUP_DIR)

    # A few shell aliases that PK likes...
    put(_conf_path('ocl_aliases'), '~/.bash_aliases')
    put(_conf_path('tmux.conf'), '~/.tmux.conf') 
开发者ID:OpenConceptLab,项目名称:ocl_web,代码行数:25,代码来源:fabfile.py

示例2: _update_app

# 需要导入模块: from fabric import colors [as 别名]
# 或者: from fabric.colors import yellow [as 别名]
def _update_app():
    with cd(env.app_dir):
        print yellow('Fetch the Code')
        run('git pull {remote} {branch}'.format(
            remote=REMOTE,
            branch=BRANCH))

        print yellow('Update the Python Requirements')
        _run('install -r requirements.txt --quiet', 'pip')

        print yellow('Cleanning the .pyc files')
        _run('manage.py clean_pyc')

        print yellow('Migrate the DB')
        _run('manage.py migrate --noinput --verbosity=0')

        print yellow('Collecting the static files')
        _run('manage.py collectstatic --noinput --verbosity=0')

        print yellow('Compiling the strings')
        _run('manage.py compilemessages')

        print green('App succefully updated') 
开发者ID:luanfonceca,项目名称:speakerfight,代码行数:25,代码来源:fabfile.py

示例3: __init__

# 需要导入模块: from fabric import colors [as 别名]
# 或者: from fabric.colors import yellow [as 别名]
def __init__(self, callback, color=colors.yellow, title=None):
        super(Infrastructure, self).__init__()

        # We need to be sure that `default()` will be at first place
        # every time when vars(self) is being invoked.
        # This is necessary to exclude `default` from the list of task
        # because of it's already there as default task.
        # See `fabric.main.extract_tasks()` for details
        self.__dict__ = utils.PriorityDict(self.__dict__, priority=['default'])

        default, confirm = self.default, self.confirm

        self.callback = callback
        self.name = getattr(callback, '__name__', self.name)
        self.title = color(title or self.name)
        self.__doc__ = (self.__doc__ or '').format(**self.__dict__)
        default.__doc__ = (default.__doc__ or '').format(**self.__dict__)
        confirm.__doc__ = (confirm.__doc__ or '').format(**self.__dict__)

        # enable "module" behaviour in task mode
        self.use_task_objects = not is_task_mode() 
开发者ID:renskiy,项目名称:fabricio,代码行数:23,代码来源:tasks.py

示例4: createdb

# 需要导入模块: from fabric import colors [as 别名]
# 或者: from fabric.colors import yellow [as 别名]
def createdb(database_name, database_user, get_password):
    if confirm(colors.red(
        "Show DB Password? You should only run this when others aren't looking over your shoulder. Run the command?")):
        print((colors.blue("Password: ") + colors.yellow(get_password())))
    if confirm(colors.red("This will overwrite local data, are you sure?")):
        UbuntuPgCreateDbAndUser(database_name, database_user)()


# ------------------------------------------------------------------------------- 
开发者ID:cyanfish,项目名称:heltour,代码行数:11,代码来源:strabulous.py

示例5: latest_live_db

# 需要导入模块: from fabric import colors [as 别名]
# 或者: from fabric.colors import yellow [as 别名]
def latest_live_db(live_backup_script_path, live_latest_sql_file_path, database_name, database_user,
                   get_password):
    if confirm(colors.red("This will overwrite local data, are you sure?")):
        if confirm(colors.red("Create a new backup?")):
            run(live_backup_script_path)
        local_target = project_relative("data/latestdb.sql.bz2")
        if confirm(colors.red("Download New backup?")):
            local_db = get(live_latest_sql_file_path, local_target)[0]
        else:
            local_db = local_target
        with settings(warn_only=True):
            if confirm(colors.red(
                "Show password? You should only run this when others aren't looking over your shoulder. Show database password?")):
                print((colors.blue("Password: ") + colors.yellow(get_password())))
            PgLoadPlain(local_db, database_name, database_user)() 
开发者ID:cyanfish,项目名称:heltour,代码行数:17,代码来源:strabulous.py

示例6: log

# 需要导入模块: from fabric import colors [as 别名]
# 或者: from fabric.colors import yellow [as 别名]
def log(msg, important=False):
    if important:
        puts(colors.green(msg))
    else:
        puts(colors.yellow(msg)) 
开发者ID:afrase,项目名称:kodiswift,代码行数:7,代码来源:fabfile.py

示例7: create_api_database

# 需要导入模块: from fabric import colors [as 别名]
# 或者: from fabric.colors import yellow [as 别名]
def create_api_database():
    """ Helper to create the API mongo database """
    with cd('/opt/deploy/ocl_api/ocl'):
        with prefix('source /opt/virtualenvs/ocl_api/bin/activate'):
            with prefix('export DJANGO_CONFIGURATION="Production"'):
                with prefix('export DJANGO_SECRET_KEY="blah"'):

                    print yellow('creating API database...')
                    # no super user
                    run('./manage.py syncdb --noinput')
                    put(_conf_path('mongo_setup.js'), '~/mongo_setup.js')
                    run('mongo ocl ~/mongo_setup.js')

    # now start the server so that we can create base users
    print yellow('Start up partial API server...')
    run('supervisorctl start ocl_api')

    with cd('/opt/deploy/ocl_api/ocl'):
        with prefix('source /opt/virtualenvs/ocl_api/bin/activate'):
            with prefix('export DJANGO_CONFIGURATION="Production"'):
                with prefix('export DJANGO_SECRET_KEY="blah"'):

                    print yellow('creating internal users: admin and anon ...')
                    run('./manage.py create_tokens --create --password password')

    # now grab the token for the web config
    print yellow('Put tokens into WEB app config...')
    setup_supervisor()
    run('supervisorctl reread')
    run('supervisorctl update')
    # update shell env setup file with new tokens
    files.upload_template(_conf_path(
        'shell_prep.sh'), '~/shell_prep.sh', env)

    # create sysadmin user
    with prefix('source /opt/virtualenvs/ocl_web/bin/activate'):
        print yellow('creating sysadmin user...')
        run('source ~/shell_prep.sh;/opt/deploy/ocl_web/ocl_web/manage.py create_sysadmin') 
开发者ID:OpenConceptLab,项目名称:ocl_web,代码行数:40,代码来源:fabfile.py

示例8: install_root_key

# 需要导入模块: from fabric import colors [as 别名]
# 或者: from fabric.colors import yellow [as 别名]
def install_root_key():
    """Install your SSH key for root. One time task.
    """
    with settings(user='root'):
        print yellow('setting up SSH for root')
        ssh_path = '/root/.ssh'
        if not files.exists(ssh_path, verbose=True):
            run('mkdir %s' % ssh_path)
            run('chmod 700 %s' % ssh_path)
        key_text = _read_key_file('~/.ssh/id_rsa.pub')
        files.append('%s/authorized_keys' % ssh_path, key_text) 
开发者ID:OpenConceptLab,项目名称:ocl_web,代码行数:13,代码来源:fabfile.py

示例9: common_install

# 需要导入模块: from fabric import colors [as 别名]
# 或者: from fabric.colors import yellow [as 别名]
def common_install():
    """Basic one-time setup for common packages for ubuntu servers.

    Currently DB stuff and web stuff are listed together. Could split
    them if we run separate servers.
    """
    print yellow('common_install...')
    sudo('apt-get update')

    # user console tools
    sudo("apt-get -y -q install emacs23-nox unzip lsof byobu httpie")

    # application libraries
    sudo("apt-get -y -q  install python-pip git-core")
    sudo('apt-get -y -q install build-essential python-dev')
    sudo("apt-get -y -q  install libpq-dev")

    sudo("apt-get -y -q install supervisor")
    sudo("pip install virtualenv")

    # web
    # memcached
    sudo('apt-get -y -q install nginx')

    # database
    # if you don't want database, at least install the client
    # sudo("apt-get -y -q install postgresql-client")
    sudo("apt-get -y -q install postgresql postgresql-contrib")
    # Could use redis for celery but not yet
    # sudo("apt-get -q install redis-server") 
开发者ID:OpenConceptLab,项目名称:ocl_web,代码行数:32,代码来源:fabfile.py

示例10: setup_solr

# 需要导入模块: from fabric import colors [as 别名]
# 或者: from fabric.colors import yellow [as 别名]
def setup_solr():
    """ Setup solr server """
    sudo('apt-get -y -q install openjdk-7-jdk')

    ## no need?
    ## sudo('mkdir /usr/java')
    ## sudo('ln -s /usr/lib/jvm/java-7-openjdk-amd64 /usr/java/default')

    with cd('/opt'):
        sudo('wget http://archive.apache.org/dist/lucene/solr/4.9.1/solr-4.9.1.tgz')
        sudo('tar -xvf solr-4.9.1.tgz')
        sudo('cp -R solr-4.9.1/example /opt/solr')
        sudo('chown -R deploy:deploy /opt/solr')

    with settings(user='root'):
        put(_conf_path('default.jetty'), '/etc/default/jetty')
        put(_conf_path('jetty'), '/etc/init.d')
        run('chmod a+x /etc/init.d/jetty')

    if not files.exists('/var/log/solr'):
        sudo('mkdir /var/log/solr')
        sudo('chown deploy:deploy /var/log/solr')

    with cd('/opt/deploy/'):
        print yellow('creating project root for %s' % 'solr')
        run('mkdir %s' % 'solr') 
开发者ID:OpenConceptLab,项目名称:ocl_web,代码行数:28,代码来源:fabfile.py

示例11: get_api_tokens

# 需要导入模块: from fabric import colors [as 别名]
# 或者: from fabric.colors import yellow [as 别名]
def get_api_tokens():
    """
    Get the API_AUTH_TOKEN and ANON_TOKEN from the API server directly

    return tuple or None:
        (api_token, anon_token)
    """
    api_token = anon_token = None
    if not files.exists('/opt/deploy/ocl_api/ocl'):
        return (None, None)

    with cd('/opt/deploy/ocl_api/ocl'):
        with prefix("source /opt/virtualenvs/ocl_api/bin/activate"):
            with prefix('export DJANGO_CONFIGURATION="Production"'):
                with prefix('export DJANGO_SECRET_KEY="blah"'):

                    print yellow('Getting AUTH Tokens')
                    data = run('./manage.py create_tokens')
                    # get back two lines in export form:
                    #    export OCL_API_TOKEN='NNN'
                    #    export OCL_ANON_API_TOKEN='NNNN'
                    # sometimes we get into a chicken and egg situation
                    # with a bad server image. So handle error cases
                    lines = data.split('\n')
                    if len(lines) < 2:
                        return (None, None)

                    r = re.search("export OCL_API_TOKEN='(\w+)'", lines[0])
                    if r is None:
                        return (None, None)
                    api_token = r.group(1)
                    r = re.search("export OCL_ANON_API_TOKEN='(\w+)'", lines[1])
                    if r is None:
                        return (None, None)
                    anon_token = r.group(1)

                    print 'API Token: %s,  Anon Token: %s' % (api_token, anon_token)
                    return (api_token, anon_token) 
开发者ID:OpenConceptLab,项目名称:ocl_web,代码行数:40,代码来源:fabfile.py

示例12: load_site_name

# 需要导入模块: from fabric import colors [as 别名]
# 或者: from fabric.colors import yellow [as 别名]
def load_site_name():
    """
    Set the global site object value in the web server, used in outbound emails.
    """
    with cd('/opt/deploy/ocl_web'):
        with prefix('source /opt/virtualenvs/ocl_web/bin/activate'):
            with prefix('export DJANGO_CONFIGURATION="Production"'):
                with prefix('export DJANGO_SECRET_KEY="blah"'):
                    print yellow('setting site name...')
                    run('ocl_web/manage.py loaddata ocl_web/config/sites.%s.json' % env.site_spec) 
开发者ID:OpenConceptLab,项目名称:ocl_web,代码行数:12,代码来源:fabfile.py

示例13: clear_databases

# 需要导入模块: from fabric import colors [as 别名]
# 或者: from fabric.colors import yellow [as 别名]
def clear_databases():
    """ Clear out all databases. This is very destructive, only useful for testing! """

    require('hosts', provided_by=['dev', 'staging', 'production'])
    ans = prompt('This will completely wipe out the database. Are you sure (YES/no)?')
    if ans != 'YES':
        print yellow('Glad you were just kidding.')
        return

    ans = prompt(yellow('%s' % env.hosts[0]) + ' database will be wiped. Are you sure (YES/no)?')
    if ans != 'YES':
        print "Didn't think so."
        return

    run('supervisorctl stop all')
    print yellow('Recreate WEB database')
    run('dropdb  ocl_web')
    run('createdb -O deploy ocl_web')
    # setup DB
    with prefix('source /opt/virtualenvs/ocl_web/bin/activate'):
        with prefix('export DJANGO_CONFIGURATION="Production"'):
            with prefix('export DJANGO_SECRET_KEY="blah"'):
                print yellow('creating WEB database...')
                run('/opt/deploy/ocl_web/ocl_web/manage.py syncdb --noinput --migrate')

    print yellow('Recreate API database')
    run('echo -e "use ocl \n db.dropDatabase();" | mongo')
    create_api_database() 
开发者ID:OpenConceptLab,项目名称:ocl_web,代码行数:30,代码来源:fabfile.py

示例14: load_orgs_and_sources

# 需要导入模块: from fabric import colors [as 别名]
# 或者: from fabric.colors import yellow [as 别名]
def load_orgs_and_sources():
    """
    Load standard set of organization and source
    """
    with prefix('source /opt/virtualenvs/ocl_web/bin/activate'):
        with cd('/opt/deploy/ocl_web/ocl_web'):
            print yellow('creating basic ORGS and SOURCES...')
            run('source ~/shell_prep.sh;/opt/deploy/ocl_web/ocl_web/manage.py ' +
                'create_org --username=sysadmin --csv=fixtures/orgs.csv')
            run('source ~/shell_prep.sh;/opt/deploy/ocl_web/ocl_web/manage.py ' +
                'create_source --username=sysadmin --csv=fixtures/ocl_sources.csv') 
开发者ID:OpenConceptLab,项目名称:ocl_web,代码行数:13,代码来源:fabfile.py

示例15: build_new_server

# 需要导入模块: from fabric import colors [as 别名]
# 或者: from fabric.colors import yellow [as 别名]
def build_new_server():
    """ Build a brand new server from scratch. """
    require('hosts', provided_by=['dev', 'staging', 'production'])
    ans = prompt('This will completely wipe out the server. Are you sure (YES/no)?')
    if ans != 'YES':
        print yellow('Glad you were just kidding.')
        return

    ans = prompt(yellow('%s' % env.hosts[0]) + ' will be wiped and rebuilt. Are you sure (YES/no)?')
    if ans != 'YES':
        print "Didn't think so."
        return

    env.keepalive = 30

    install_root_key()
    add_deploy_user()
    common_install()
    setup_environment()
    setup_solr()
    setup_mongo()
    setup_postgres()
    setup_supervisor()
    build_api_app()
    build_web_app()
    setup_nginx()
    full_restart() 
开发者ID:OpenConceptLab,项目名称:ocl_web,代码行数:29,代码来源:fabfile.py


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