當前位置: 首頁>>代碼示例>>Python>>正文


Python colors.red方法代碼示例

本文整理匯總了Python中fabric.colors.red方法的典型用法代碼示例。如果您正苦於以下問題:Python colors.red方法的具體用法?Python colors.red怎麽用?Python colors.red使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在fabric.colors的用法示例。


在下文中一共展示了colors.red方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: setup

# 需要導入模塊: from fabric import colors [as 別名]
# 或者: from fabric.colors import red [as 別名]
def setup(config_file_path):
    global config
    global data
    global backup_local_file

    try:
        config = yaml.load(open(config_file_path))
    except IOError as e:
        print(str(e))
        abort(colors.red("No such file. Please add a configuration "
                         "file similar to sample_config.yaml\n"))
    except Exception as e:
        print(str(e))
        abort(colors.red("Please check the configuration file. "
                         "It should be a YAML file similar to "
                         "sample_config.yaml\n"))
    else:
        if config is None:
            config = {}
        data = config.get("local") or {}
        if data and data.get("project_root"):
            backup_local_file = data.get("project_root") + \
                '/local_db_backup_%s.sql' % str(datetime.now().date()) 
開發者ID:MicroPyramid,項目名稱:deploy-python,代碼行數:25,代碼來源:commands.py

示例2: is_manager

# 需要導入模塊: from fabric import colors [as 別名]
# 或者: from fabric.colors import red [as 別名]
def is_manager(self, raise_manager_error=True):
        is_manager = self.managers.get(fab.env.host)
        try:
            if is_manager is None:
                is_manager = self.managers[fab.env.host] = self._is_manager()
        except fabricio.host_errors as error:
            is_manager = self.managers[fab.env.host] = False
            fabricio.log(
                'WARNING: {error}'.format(error=error),
                output=sys.stderr,
                color=colors.red,
            )
        finally:
            if (
                raise_manager_error
                and len(self.managers) >= len(fab.env.all_hosts)
                and not any(self.managers.values())
            ):
                msg = 'service manager not found or it failed to pull image'
                raise ManagerNotFoundError(msg)
        return is_manager 
開發者ID:renskiy,項目名稱:fabricio,代碼行數:23,代碼來源:base.py

示例3: restart_core

# 需要導入模塊: from fabric import colors [as 別名]
# 或者: from fabric.colors import red [as 別名]
def restart_core():
    print green('Restart the core platform via the restart.sh scripts.')

    ret = run("ps -ef|grep newark-core-platform|grep -v grep|cut -c 9-15")

    if ret:
        with settings(hide('warnings', 'running', 'stdout', 'stderr'),warn_only=True):
            run("ps -ef|grep newark-core-platform|grep -v grep|cut -c 9-15|xargs kill -9 2>/dev/null >/dev/null")
    else:
        print red("No such progress!")

    ret_new = run("ps -ef|grep newark-core-platform|grep -v grep|cut -c 9-15")

    if ret_new:
        print red("Startup already!")
    else:
        with settings(hide('warnings', 'running', 'stdout', 'stderr'),warn_only=True):
            run('cd '+core_platform_path+' && java -jar newark-core-platform-'+core_version+'.jar 2>/dev/null >/dev/null')

    print green('Restart the core platform finished!')

# Shutdown the auth platform via the stop.sh scripts function. 
開發者ID:dbarobin,項目名稱:python-auto-deploy,代碼行數:24,代碼來源:auto_deploy_app_v_final.py

示例4: deploy_prepare

# 需要導入模塊: from fabric import colors [as 別名]
# 或者: from fabric.colors import red [as 別名]
def deploy_prepare():

    print green('Deploy prepared. Run as root.')
    # Install jdk 1.8.25.
    print red('This program require jdk 1.8.25. Make sure jdk and tomcat work out before all of your operations.')
    #Install Maven
    print green('Install maven.')
    print 'Logs output to the '+log_path+'/deploy_prepare.log'

    os.system('mkdir -p '+log_path+' 2>/dev/null >/dev/null')
    os.system("echo '' > "+log_path+"/deploy_prepare.log")
    os.system("fab -f "+script_name+" deploy_prepare > "+log_path+"/deploy_prepare.log")

    print green('Deploy prepared finished.')

# Update the databae setting. 
開發者ID:dbarobin,項目名稱:python-auto-deploy,代碼行數:18,代碼來源:auto_deploy_app_remote.py

示例5: deploylive

# 需要導入模塊: from fabric import colors [as 別名]
# 或者: from fabric.colors import red [as 別名]
def deploylive():
    manage_py = project_relative("manage.py")
    local("rm -r static")
    local("mkdir static")
    local("python %s compilestatic" % manage_py)
    local("python %s collectstatic --noinput" % manage_py)
    if confirm(colors.red(
        "This will deploy to the live server (LIVE ENV) and restart the server. Are you sure?")):
        remote_directory = "/home/lichess4545/web/www.lichess4545.com"
        local_directory = project_relative(".") + "/"
        RsyncDeployment(
            remote_directory,
            local_directory
        )(
            exclude=['env', 'data', 'lichess4545@marta.lichess.ovh', 'certs']
        )
        run(
            "echo \"/home/lichess4545/web/www.lichess4545.com/current/\" > /home/lichess4545/web/www.lichess4545.com/env/lib/python3.6/site-packages/heltour.pth")

        if confirm(colors.red("Would you like to update the dependencies?")):
            run(
                "/home/lichess4545/web/www.lichess4545.com/current/sysadmin/update-requirements-live.sh")
        if confirm(colors.red("Would you like to run the migrations?")):
            run("/home/lichess4545/web/www.lichess4545.com/current/sysadmin/migrate-live.sh")
        if confirm(colors.red("Would you like to invalidate the caches?")):
            run("/home/lichess4545/web/www.lichess4545.com/current/sysadmin/invalidate-live.sh")

        if confirm(colors.red("Would you like to restart the server?")):
            sudo("/usr/sbin/service heltour-live restart", shell=False)
            sudo("/usr/sbin/service heltour-live-api restart", shell=False)
            sudo("/usr/sbin/service heltour-live-celery restart", shell=False)

        if confirm(colors.red("Would you like to reload nginx?")):
            sudo("/usr/sbin/service nginx reload", shell=False)


# ------------------------------------------------------------------------------- 
開發者ID:cyanfish,項目名稱:heltour,代碼行數:39,代碼來源:fabfile.py

示例6: deploystaging

# 需要導入模塊: from fabric import colors [as 別名]
# 或者: from fabric.colors import red [as 別名]
def deploystaging():
    manage_py = project_relative("manage_staging.py")
    local("rm -r static")
    local("mkdir static")
    local("python %s compilestatic" % manage_py)
    local("python %s collectstatic --noinput" % manage_py)
    if confirm(colors.red(
        "This will deploy to the live server (STAGING ENV) and restart the server. Are you sure?")):
        remote_directory = "/home/lichess4545/web/staging.lichess4545.com"
        local_directory = project_relative(".") + "/"
        RsyncDeployment(
            remote_directory,
            local_directory
        )(
            exclude=['env', 'data', 'lichess4545@marta.lichess.ovh', 'certs']
        )
        run(
            "echo \"/home/lichess4545/web/staging.lichess4545.com/current/\" > /home/lichess4545/web/staging.lichess4545.com/env/lib/python3.6/site-packages/heltour.pth")

        if confirm(colors.red("Would you like to update the dependencies?")):
            run(
                "/home/lichess4545/web/staging.lichess4545.com/current/sysadmin/update-requirements-staging.sh")
        if confirm(colors.red("Would you like to run the migrations?")):
            run("/home/lichess4545/web/staging.lichess4545.com/current/sysadmin/migrate-staging.sh")
        if confirm(colors.red("Would you like to invalidate the caches?")):
            run(
                "/home/lichess4545/web/staging.lichess4545.com/current/sysadmin/invalidate-staging.sh")

        if confirm(colors.red("Would you like to restart the server?")):
            sudo("/usr/sbin/service heltour-staging restart", shell=False)
            sudo("/usr/sbin/service heltour-staging-api restart", shell=False)
            sudo("/usr/sbin/service heltour-staging-celery restart", shell=False)

        if confirm(colors.red("Would you like to reload nginx?")):
            sudo("/usr/sbin/service nginx reload", shell=False)


# ------------------------------------------------------------------------------- 
開發者ID:cyanfish,項目名稱:heltour,代碼行數:40,代碼來源:fabfile.py

示例7: restartlive

# 需要導入模塊: from fabric import colors [as 別名]
# 或者: from fabric.colors import red [as 別名]
def restartlive():
    if confirm(colors.red("Would you like to invalidate the caches?")):
        run("/home/lichess4545/web/www.lichess4545.com/current/sysadmin/invalidate-live.sh")

    if confirm(colors.red("Would you like to restart the server?")):
        sudo("/usr/sbin/service heltour-live restart", shell=False)
        sudo("/usr/sbin/service heltour-live-api restart", shell=False)
        sudo("/usr/sbin/service heltour-live-celery restart", shell=False)


# ------------------------------------------------------------------------------- 
開發者ID:cyanfish,項目名稱:heltour,代碼行數:13,代碼來源:fabfile.py

示例8: restartstaging

# 需要導入模塊: from fabric import colors [as 別名]
# 或者: from fabric.colors import red [as 別名]
def restartstaging():
    if confirm(colors.red("Would you like to invalidate the caches?")):
        run("/home/lichess4545/web/staging.lichess4545.com/current/sysadmin/invalidate-staging.sh")

    if confirm(colors.red("Would you like to restart the server?")):
        sudo("/usr/sbin/service heltour-staging restart", shell=False)
        sudo("/usr/sbin/service heltour-staging-api restart", shell=False)
        sudo("/usr/sbin/service heltour-staging-celery restart", shell=False)


# ------------------------------------------------------------------------------- 
開發者ID:cyanfish,項目名稱:heltour,代碼行數:13,代碼來源:fabfile.py

示例9: restartchesster

# 需要導入模塊: from fabric import colors [as 別名]
# 或者: from fabric.colors import red [as 別名]
def restartchesster():
    if confirm(colors.red("Would you like to restart chesster?")):
        sudo("/usr/sbin/service chesster restart", shell=False)


# ------------------------------------------------------------------------------- 
開發者ID:cyanfish,項目名稱:heltour,代碼行數:8,代碼來源:fabfile.py

示例10: latest_live_media

# 需要導入模塊: from fabric import colors [as 別名]
# 或者: from fabric.colors import red [as 別名]
def latest_live_media(live_media_path, local_media_path, password_file_name, live_ssh_username,
                      live_domain):
    local_dir = local_media_path
    remote_dir = live_media_path
    if confirm(colors.red("This will overwrite local data, are you sure?")):
        RsyncMedia(
            '%s@%s' % (live_ssh_username, live_domain),
            remote_directory=remote_dir,
            local_directory=local_dir
        )()


# ------------------------------------------------------------------------------- 
開發者ID:cyanfish,項目名稱:heltour,代碼行數:15,代碼來源:strabulous.py

示例11: latest_live_db

# 需要導入模塊: from fabric import colors [as 別名]
# 或者: from fabric.colors import red [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

示例12: get_function

# 需要導入模塊: from fabric import colors [as 別名]
# 或者: from fabric.colors import red [as 別名]
def get_function():
    if not config:
        abort(colors.red("Please check the configuration file. "
                         "It should be a YAML file similar to "
                         "sample_config.yaml\n"))

    if run_on == "local":
        return local
    else:
        if not env.hosts:
            print("Please check the hosts(servers) settings for '%s' "
                  "in the config file." % str(run_on))
            return None
        return run 
開發者ID:MicroPyramid,項目名稱:deploy-python,代碼行數:16,代碼來源:commands.py

示例13: _print_stats

# 需要導入模塊: from fabric import colors [as 別名]
# 或者: from fabric.colors import red [as 別名]
def _print_stats(filename):
    try:
        stat = os.stat(filename)
    except OSError:
        print(red('Not found {}'.format(filename)))
        print(red('Exiting.'))
        exit()

    last_modified = str(datetime.fromtimestamp(stat.st_mtime))
    print(blue('Found {}, last modifed: {}'.format(filename, last_modified))) 
開發者ID:dimagi,項目名稱:commcare-cloud,代碼行數:12,代碼來源:offline.py

示例14: parse_int_or_exit

# 需要導入模塊: from fabric import colors [as 別名]
# 或者: from fabric.colors import red [as 別名]
def parse_int_or_exit(val):
    try:
        return int(val)
    except (ValueError, TypeError):
        print(red("Unable to parse '{}' into an integer".format(val)))
        exit() 
開發者ID:dimagi,項目名稱:commcare-cloud,代碼行數:8,代碼來源:fabfile.py

示例15: apply_patch

# 需要導入模塊: from fabric import colors [as 別名]
# 或者: from fabric.colors import red [as 別名]
def apply_patch(patchfile=None):
    """
    Used to apply a git patch created via `git format-patch`. Usage:

        fab <env> apply_patch:patchfile=/path/to/patch

    Note: Only use this when absolutely necessary. Normally we should use regular
    deploy. This is only used for patching when we do not have access to the Internet.
    """
    if not patchfile:
        print(red("Must specify patch filepath"))
        exit()
    execute(release.apply_patch, patchfile)
    silent_services_restart(use_current_release=True) 
開發者ID:dimagi,項目名稱:commcare-cloud,代碼行數:16,代碼來源:fabfile.py


注:本文中的fabric.colors.red方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。