本文整理汇总了Python中fabric.colors.green方法的典型用法代码示例。如果您正苦于以下问题:Python colors.green方法的具体用法?Python colors.green怎么用?Python colors.green使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类fabric.colors
的用法示例。
在下文中一共展示了colors.green方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: release_perform
# 需要导入模块: from fabric import colors [as 别名]
# 或者: from fabric.colors import green [as 别名]
def release_perform(xbmc_version, local_repo, dist_repo):
# Stage everything in the repo
log('Staging all modified files in the distribution repo...')
dist_repo.stage_all()
# Get the current Kodi version
version = get_addon_version(dist_repo.path)
# Commit all staged changes and tag
log('Commiting changes and tagging the release...')
dist_repo.commit(version)
dist_repo.tag(version, '%s v%s' % (xbmc_version, version))
# Tag the local repo as well
local_repo.tag('xbmc-%s' % version, 'Kodi distribution v%s' % version)
# Push everything
log('Pushing changes to remote...')
dist_repo.push(BRANCHES[xbmc_version])
puts(colors.green('Release performed.'))
# write the email
addon_id = get_addon_id(dist_repo.path)
print_email(addon_id, version, REPO_PUBLIC_URL, version, xbmc_version.lower())
示例2: check_hosts
# 需要导入模块: from fabric import colors [as 别名]
# 或者: from fabric.colors import green [as 别名]
def check_hosts():
"""
Check if hosts are active or not and print the result.
"""
global running_hosts
running_hosts = dict()
for host in selected_hosts:
print(fab_col.magenta("\nPing host %d of %d" %
(selected_hosts.index(host) + 1, len(selected_hosts))))
response = os.system("ping -c 1 " + host.split("@")[1].split(":")[0])
if response == 0:
running_hosts[host] = True
else:
running_hosts[host] = False
# Convert running_hosts in order to print it as table
mylist = map(lambda index: [index[0], str(index[1])], running_hosts.items())
print(fab_col.green(tabulate(mylist, ["Host", "Running"])))
示例3: _update_app
# 需要导入模块: from fabric import colors [as 别名]
# 或者: from fabric.colors import green [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')
示例4: svn_update_admin
# 需要导入模块: from fabric import colors [as 别名]
# 或者: from fabric.colors import green [as 别名]
def svn_update_admin():
print green('Update the mall admin repo via svn.')
# Create necessary directory.
run('mkdir -p '+svn_sw_dir+' 2>/dev/null >/dev/null')
run('mkdir -p '+svn_admin_path+' 2>/dev/null >/dev/null')
# Svn update.
with cd(admin_path):
run('svn update')
print green('Update finished!')
# Update the mall api repo via svn function.
示例5: deploy_admin
# 需要导入模块: from fabric import colors [as 别名]
# 或者: from fabric.colors import green [as 别名]
def deploy_admin():
print green('Deploy mall admin via ant.')
# Create the build.xml directory.
run('mkdir -p ~/build-xml 2>/dev/null >/dev/null')
run('mkdir -p ~/build-xml/admin 2>/dev/null >/dev/null')
# Remove the mall admin.
run('rm -rf '+tomcat_path+'/YOUR_PROJECT*')
# Copy the mall admin build.xml.
run('cp -v ~/build-xml/admin/build.xml '+admin_path+'')
with cd(admin_path):
run('ant -buildfile build.xml')
run('mv YOUR_PROJECT.war '+tomcat_path+'')
print green('Congratulations! Deploy mall admin finished!')
# Deploy mall api via ant function.
示例6: shutdown_admin
# 需要导入模块: from fabric import colors [as 别名]
# 或者: from fabric.colors import green [as 别名]
def shutdown_admin():
print green('Shutdown the mall admin via the shutdown.sh scripts.')
print 'Logs output to the '+log_path+'/shutdown_admin.log'
os.system('mkdir -p '+log_path+' 2>/dev/null >/dev/null')
os.system("echo '' > "+log_path+"/shutdown_admin.log")
with settings(hide('warnings', 'running', 'stdout', 'stderr'),warn_only=True):
os.system("fab -f "+script_name+" shutdown_admin > "+log_path+"/shutdown_admin.log 2>/dev/null >/dev/null")
with settings(hide('warnings', 'running', 'stdout', 'stderr'),warn_only=True):
os.system("fab -f "+script_name+" shutdown_admin > "+log_path+"/shutdown_admin.log 2>/dev/null >/dev/null")
print green('Shutdown the mall admin finished!')
# Startup the mall admin via the startup.sh scripts function.
示例7: shutdown_api
# 需要导入模块: from fabric import colors [as 别名]
# 或者: from fabric.colors import green [as 别名]
def shutdown_api():
print green('Shutdown the mall api via the shutdown.sh scripts.')
print 'Logs output to the '+log_path+'/shutdown_api.log'
os.system('mkdir -p '+log_path+' 2>/dev/null >/dev/null')
os.system("echo '' > "+log_path+"/shutdown_api.log")
with settings(hide('warnings', 'running', 'stdout', 'stderr'),warn_only=True):
os.system("fab -f "+script_name+" shutdown_api > "+log_path+"/shutdown_api.log 2>/dev/null >/dev/null")
with settings(hide('warnings', 'running', 'stdout', 'stderr'),warn_only=True):
os.system("fab -f "+script_name+" shutdown_api > "+log_path+"/shutdown_api.log 2>/dev/null >/dev/null")
print green('Shutdown the mall api finished!')
# Startup the mall api via the startup.sh scripts function.
示例8: deploy_admin
# 需要导入模块: from fabric import colors [as 别名]
# 或者: from fabric.colors import green [as 别名]
def deploy_admin():
print green('Deploy mall admin via ant.')
# Create the build.xml directory.
run('mkdir -p ~/build-xml-test 2>/dev/null >/dev/null')
run('mkdir -p ~/build-xml-test/admin 2>/dev/null >/dev/null')
# Remove the mall admin.
run('rm -rf '+tomcat_path+'/YOUR_PROJECT*')
# Copy the mall admin build.xml.
run('cp -v ~/build-xml-test/admin/build.xml '+admin_path+'')
with cd(admin_path):
run('ant -buildfile build.xml')
run('mv YOUR_PROJECT.war '+tomcat_path+'')
print green('Congratulations! Deploy mall admin finished!')
# Deploy mall api via ant function.
示例9: pre_conf
# 需要导入模块: from fabric import colors [as 别名]
# 或者: from fabric.colors import green [as 别名]
def pre_conf():
print green('Pre config before generate testing reports.')
# Create necessary directory.
run('mkdir -p '+script_dir+' 2>/dev/null >/dev/null')
run('mkdir -p '+mall_script+' 2>/dev/null >/dev/null')
run('mkdir -p '+report_dir+' 2>/dev/null >/dev/null')
os.system('mkdir -p '+report_exp_dir+' 2>/dev/null >/dev/null')
# Copy neccessary libs.
run('cp '+jmeter_home+'/lib/xalan-2.7.2.jar '+ant_home+'/lib')
run('cp '+jmeter_home+'/lib/serializer-2.7.2.jar '+ant_home+'/lib')
# Update the neccessary properties.
run("sed -i 's/^#jmeter.save.saveservice.output_format=csv/jmeter.save.saveservice.output_format=xml/g' '+jmeter_home+'+/bin/jmeter.properties")
# Copy neccessary image.
run('cp '+jmeter_home+'/extras/expand.png '+jmeter_home+'/extras/collapse.png '+report_dir+'')
print green('Pre config before generate testing reports finished!')
# Auto generate testing reports.
示例10: scp_report
# 需要导入模块: from fabric import colors [as 别名]
# 或者: from fabric.colors import green [as 别名]
def scp_report():
print green('SCP generated testing reports.')
oneday = datetime.timedelta(days=1)
today = datetime.datetime.now()
yesterday = datetime.datetime.now() - oneday
tomorrow = datetime.datetime.now() + oneday
yesterday_date = datetime.datetime.strftime(yesterday, '%Y%m%d')
today_date = datetime.datetime.strftime(today, '%Y%m%d')
tomorrow_date = datetime.datetime.strftime(tomorrow, '%Y%m%d')
os.system('scp '+remote_usr+'@'+remote_ip+':'+report_dir+'/mall/collapse.png '+report_exp_dir+' 2>/dev/null')
os.system('scp '+remote_usr+'@'+remote_ip+':'+report_dir+'/mall/expand.png '+report_exp_dir+' 2>/dev/null')
os.system('scp '+remote_usr+'@'+remote_ip+':'+report_dir+'/mall/QA_REPORT_'+yesterday_date+'* '+report_exp_dir+' 2>/dev/null')
os.system('scp '+remote_usr+'@'+remote_ip+':'+report_dir+'/mall/QA_REPORT_'+today_date+'* '+report_exp_dir+' 2>/dev/null')
os.system('scp '+remote_usr+'@'+remote_ip+':'+report_dir+'/mall/QA_REPORT_'+tomorrow_date+'* '+report_exp_dir+' 2>/dev/null')
print green('SCP generated testing reports finished!')
示例11: log
# 需要导入模块: from fabric import colors [as 别名]
# 或者: from fabric.colors import green [as 别名]
def log(msg, important=False):
if important:
puts(colors.green(msg))
else:
puts(colors.yellow(msg))
示例12: install_it
# 需要导入模块: from fabric import colors [as 别名]
# 或者: from fabric.colors import green [as 别名]
def install_it(package):
sudo('pip install {}'.format(package))
print green('{} installed'.format(package))
示例13: log_call
# 需要导入模块: from fabric import colors [as 别名]
# 或者: from fabric.colors import green [as 别名]
def log_call(func):
@wraps(func)
def logged(*args, **kawrgs):
header = "-" * len(func.__name__)
_print(green("\n".join([header, func.__name__, header]), bold=True))
return func(*args, **kawrgs)
return logged
示例14: print_hosts
# 需要导入模块: from fabric import colors [as 别名]
# 或者: from fabric.colors import green [as 别名]
def print_hosts():
"""
Print selected hosts.
If hosts haven't been hand-selected yet, all hosts are selected.
"""
hosts = map(lambda x: [x, env.passwords.get(x, None)], selected_hosts)
print(fab_col.green(tabulate(hosts, ["Host", "Password"])))
示例15: _restart_app
# 需要导入模块: from fabric import colors [as 别名]
# 或者: from fabric.colors import green [as 别名]
def _restart_app():
print yellow('Restart the Uwsgi')
run('service uwsgi restart')
print yellow('Restart the Nginx')
run('service nginx restart')
print green('Services succefully restarted')