本文整理汇总了Python中utils.confirm函数的典型用法代码示例。如果您正苦于以下问题:Python confirm函数的具体用法?Python confirm怎么用?Python confirm使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了confirm函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: deploy
def deploy(remote="origin"):
"""
Deploy the latest app to S3 and, if configured, to our servers.
"""
require("settings", provided_by=[production, staging])
if app_config.DEPLOY_TO_SERVERS:
require("branch", provided_by=[stable, master, branch])
if app_config.DEPLOYMENT_TARGET == "production" and env.branch != "stable":
utils.confirm(
"You are trying to deploy the '%s' branch to production.\nYou should really only deploy a stable branch.\nDo you know what you're doing?"
% env.branch
)
if app_config.DEPLOY_TO_SERVERS:
checkout_latest(remote)
fabcast("update_copy")
fabcast("assets_sync")
fabcast("update_data")
if app_config.DEPLOY_CRONTAB:
install_crontab()
if app_config.DEPLOY_SERVICES:
deploy_confs()
compiled_includes = render()
render_dorms(compiled_includes)
_gzip("www", ".gzip")
_deploy_to_s3()
_gzip(".dorms_html", ".dorms_gzip")
_deploy_to_s3(".dorms_gzip")
开发者ID:TylerFisher,项目名称:housing2,代码行数:34,代码来源:__init__.py
示例2: app_template_bootstrap
def app_template_bootstrap(project_name=None, repository_name=None):
"""
Execute the bootstrap tasks for a new project.
"""
config_files = ' '.join(['PROJECT_README.md', 'app_config.py'])
config = {}
config['$NEW_PROJECT_SLUG'] = os.getcwd().split('/')[-1]
config['$NEW_PROJECT_NAME'] = project_name or config['$NEW_PROJECT_SLUG']
config['$NEW_REPOSITORY_NAME'] = repository_name or config['$NEW_PROJECT_SLUG']
config['$NEW_PROJECT_FILENAME'] = config['$NEW_PROJECT_SLUG'].replace('-', '_')
utils.confirm("Have you created a Github repository named \"%s\"?" % config['$NEW_REPOSITORY_NAME'])
for k, v in config.items():
local('sed -i "" \'s|%s|%s|g\' %s' % (k, v, config_files))
local('rm -rf .git')
local('git init')
local('mv PROJECT_README.md README.md')
local('rm *.pyc')
local('rm LICENSE')
local('git add .')
local('git commit -am "Initial import from app-template."')
local('git remote add origin [email protected]:nprapps/%s.git' % config['$NEW_REPOSITORY_NAME'])
local('git push -u origin master')
local('mkdir ~/Dropbox/nprapps/assets/%s' % config['$NEW_PROJECT_NAME'])
开发者ID:nprapps,项目名称:musicgame,代码行数:28,代码来源:__init__.py
示例3: deploy
def deploy(remote='origin'):
"""
Deploy the latest app to S3 and, if configured, to our servers.
"""
require('settings', provided_by=[production, staging])
if app_config.DEPLOY_TO_SERVERS:
require('branch', provided_by=[stable, master, branch])
if (app_config.DEPLOYMENT_TARGET == 'production' and env.branch != 'stable'):
utils.confirm("You are trying to deploy the '%s' branch to production.\nYou should really only deploy a stable branch.\nDo you know what you're doing?" % env.branch)
if app_config.DEPLOY_TO_SERVERS:
checkout_latest(remote)
fabcast('update_copy')
fabcast('assets_sync')
fabcast('update_data')
if app_config.DEPLOY_CRONTAB:
install_crontab()
if app_config.DEPLOY_SERVICES:
deploy_confs()
compiled_includes = render.render_all()
render.render_dorms(compiled_includes)
sass()
# _gzip('www', '.gzip')
# _deploy_to_s3()
# _gzip('.dorms_html', '.dorms_gzip')
# _deploy_to_s3('.dorms_gzip')
local('rm -rf dist')
local('cp -r .dorms_html dist')
local('cp -r www/ dist/')
开发者ID:northbynorthwestern,项目名称:2016-housing-guide,代码行数:35,代码来源:__init__.py
示例4: go
def go(github_username='nprapps', repository_name=None):
"""
Execute the bootstrap tasks for a new project.
"""
config_files = ' '.join(['PROJECT_README.md', 'app_config.py'])
config = {}
config['$NEW_PROJECT_SLUG'] = os.getcwd().split('/')[-1]
config['$NEW_REPOSITORY_NAME'] = repository_name or config['$NEW_PROJECT_SLUG']
config['$NEW_PROJECT_FILENAME'] = config['$NEW_PROJECT_SLUG'].replace('-', '_')
config['$NEW_DISQUS_UUID'] = str(uuid.uuid1())
utils.confirm("Have you created a Github repository named \"%s\"?" % config['$NEW_REPOSITORY_NAME'])
for k, v in config.items():
local('sed -i "" \'s|%s|%s|g\' %s' % (k, v, config_files))
local('rm -rf .git')
local('git init')
local('mv PROJECT_README.md README.md')
local('rm *.pyc')
local('rm LICENSE')
local('git add .')
local('git add -f www/assets/.assetsignore')
local('git commit -am "Initial import from app-template."')
local('git remote add origin [email protected]:%s/%s.git' % (github_username, config['$NEW_REPOSITORY_NAME']))
local('git push -u origin master')
# Update app data
execute('update')
开发者ID:BenHeubl,项目名称:lookatthis,代码行数:30,代码来源:bootstrap.py
示例5: shiva_the_destroyer
def shiva_the_destroyer():
"""
Deletes the app from s3
"""
require("settings", provided_by=[production, staging])
utils.confirm(
"You are about to destroy everything deployed to %s for this project.\nDo you know what you're doing?"
% app_config.DEPLOYMENT_TARGET
)
with settings(warn_only=True):
sync = 'aws s3 rm %s --recursive --region "us-east-1"'
for bucket in app_config.S3_BUCKETS:
local(sync % ("s3://%s/%s/" % (bucket, app_config.PROJECT_SLUG)))
if app_config.DEPLOY_TO_SERVERS:
run("rm -rf %(SERVER_PROJECT_PATH)s" % app_config.__dict__)
if app_config.DEPLOY_CRONTAB:
uninstall_crontab()
if app_config.DEPLOY_SERVICES:
nuke_confs()
开发者ID:TylerFisher,项目名称:housing2,代码行数:25,代码来源:__init__.py
示例6: shiva_the_destroyer
def shiva_the_destroyer():
"""
Deletes the app from s3
"""
require("settings", provided_by=[production, staging])
utils.confirm(
colored(
"You are about to destroy everything deployed to %s for this project.\nDo you know what you're doing?')"
% app_config.DEPLOYMENT_TARGET,
"red",
)
)
with settings(warn_only=True):
flat.delete_folder(app_config.S3_BUCKET, app_config.PROJECT_SLUG)
if app_config.DEPLOY_TO_SERVERS:
servers.delete_project()
if app_config.DEPLOY_CRONTAB:
servers.uninstall_crontab()
if app_config.DEPLOY_SERVICES:
servers.nuke_confs()
开发者ID:silvashih,项目名称:lunchbox,代码行数:25,代码来源:__init__.py
示例7: deploy
def deploy(remote='origin'):
"""
Deploy the latest app to S3 and, if configured, to our servers.
"""
require('settings', provided_by=[production, staging])
if app_config.DEPLOY_TO_SERVERS:
require('branch', provided_by=[stable, master, branch])
if (app_config.DEPLOYMENT_TARGET == 'production' and env.branch != 'stable'):
utils.confirm(
colored("You are trying to deploy the '%s' branch to production.\nYou should really only deploy a stable branch.\nDo you know what you're doing?" % env.branch, "red")
)
servers.checkout_latest(remote)
servers.fabcast('text.update')
servers.fabcast('assets.sync')
servers.fabcast('data.update')
if app_config.DEPLOY_CRONTAB:
servers.install_crontab()
if app_config.DEPLOY_SERVICES:
servers.deploy_confs()
update()
render.render_all()
_gzip('www', '.gzip')
_deploy_to_s3()
开发者ID:Dwightgnjohnson,项目名称:app-template,代码行数:30,代码来源:__init__.py
示例8: app_template_bootstrap
def app_template_bootstrap(github_username="TylerFisher", project_name=None, repository_name=None):
"""
Execute the bootstrap tasks for a new project.
"""
config_files = " ".join(["PROJECT_README.md", "app_config.py"])
config = {}
config["$NEW_PROJECT_SLUG"] = os.getcwd().split("/")[-1]
config["$NEW_PROJECT_NAME"] = project_name or config["$NEW_PROJECT_SLUG"]
config["$NEW_REPOSITORY_NAME"] = repository_name or config["$NEW_PROJECT_SLUG"]
config["$NEW_PROJECT_FILENAME"] = config["$NEW_PROJECT_SLUG"].replace("-", "_")
utils.confirm('Have you created a Github repository named "%s"?' % config["$NEW_REPOSITORY_NAME"])
for k, v in config.items():
local("sed -i \"\" 's|%s|%s|g' %s" % (k, v, config_files))
local("rm -rf .git")
local("git init")
local("mv PROJECT_README.md README.md")
local("rm *.pyc")
local("rm LICENSE")
local("git add .")
local('git commit -am "Initial import from app-template."')
local("git remote add origin [email protected]:%s/%s.git" % (github_username, config["$NEW_REPOSITORY_NAME"]))
local("git push -u origin master")
bootstrap()
开发者ID:TylerFisher,项目名称:housing2,代码行数:28,代码来源:__init__.py
示例9: deploy
def deploy(remote='origin', reload=False):
"""
Deploy the latest app to S3 and, if configured, to our servers.
"""
require('settings', provided_by=[production, staging])
if app_config.DEPLOY_TO_SERVERS:
require('branch', provided_by=[stable, master, branch])
if (app_config.DEPLOYMENT_TARGET == 'production' and env.branch != 'stable'):
utils.confirm(
colored("You are trying to deploy the '%s' branch to production.\nYou should really only deploy a stable branch.\nDo you know what you're doing?" % env.branch, "red")
)
servers.checkout_latest(remote)
if app_config.DEPLOY_CRONTAB:
servers.install_crontab()
if app_config.DEPLOY_SERVICES:
servers.deploy_confs()
update()
render.render_all()
flat.deploy_folder(
app_config.S3_BUCKET,
'www',
app_config.PROJECT_SLUG,
headers={
'Cache-Control': 'max-age=%i' % app_config.DEFAULT_MAX_AGE
},
ignore=[]
)
开发者ID:onyxfish,项目名称:median,代码行数:34,代码来源:__init__.py
示例10: shiva_the_destroyer
def shiva_the_destroyer():
"""
Deletes the app from s3
"""
require('settings', provided_by=[production, staging])
utils.confirm(
colored("You are about to destroy everything deployed to %s for this project.\nDo you know what you're doing?')" % app_config.DEPLOYMENT_TARGET, "red")
)
with settings(warn_only=True):
sync = 'aws s3 rm s3://%s/%s/ --recursive --region "%s"' % (
app_config.S3_BUCKET['bucket_name'],
app_config.PROJECT_SLUG,
app_config.S3_BUCKET['region']
)
local(sync)
if app_config.DEPLOY_TO_SERVERS:
servers.delete_project()
if app_config.DEPLOY_CRONTAB:
servers.uninstall_crontab()
if app_config.DEPLOY_SERVICES:
servers.nuke_confs()
开发者ID:helgalivsalinas,项目名称:books14,代码行数:27,代码来源:__init__.py
示例11: go
def go(github_username=app_config.GITHUB_USERNAME, repository_name=None):
"""
Execute the bootstrap tasks for a new project.
"""
config_files = " ".join(["PROJECT_README.md", "app_config.py", "crontab"])
config = {}
config["$NEW_PROJECT_SLUG"] = os.getcwd().split("/")[-1]
config["$NEW_REPOSITORY_NAME"] = repository_name or config["$NEW_PROJECT_SLUG"]
config["$NEW_PROJECT_FILENAME"] = config["$NEW_PROJECT_SLUG"].replace("-", "_")
config["$NEW_DISQUS_UUID"] = str(uuid.uuid1())
utils.confirm('Have you created a Github repository named "%s"?' % config["$NEW_REPOSITORY_NAME"])
for k, v in config.items():
local("sed -i \"\" 's|%s|%s|g' %s" % (k, v, config_files))
local("rm -rf .git")
local("git init")
local("mv PROJECT_README.md README.md")
local("rm *.pyc")
local("rm LICENSE")
local("git add .")
local("git add -f www/assets/assetsignore")
local('git commit -am "Initial import from app-template."')
local("git remote add origin [email protected]:%s/%s.git" % (github_username, config["$NEW_REPOSITORY_NAME"]))
local("git push -u origin master")
# Update app data
execute("update")
开发者ID:dailycal-projects,项目名称:public-trust,代码行数:30,代码来源:bootstrap.py
示例12: deploy
def deploy(remote='origin'):
"""
Deploy the latest app to S3 and, if configured, to our servers.
"""
require('settings', provided_by=[production, staging])
if app_config.DEPLOY_TO_SERVERS:
require('branch', provided_by=[stable, master, branch])
if (app_config.DEPLOYMENT_TARGET == 'production' and env.branch != 'stable'):
utils.confirm("You are trying to deploy the '%s' branch to production.\nYou should really only deploy a stable branch.\nDo you know what you're doing?" % env.branch)
if app_config.DEPLOY_TO_SERVERS:
checkout_latest(remote)
#fabcast('update_copy')
#fabcast('assets.sync')
#fabcast('update_data')
if app_config.DEPLOY_CRONTAB:
install_crontab()
if app_config.DEPLOY_SERVICES:
deploy_confs()
render()
_gzip('www', '.gzip')
_deploy_to_s3()
_cleanup_minified_includes()
开发者ID:nprapps,项目名称:musicgame,代码行数:29,代码来源:__init__.py
示例13: post
def post(slug):
"""
Set the post to work on.
"""
# Force root path every time
fab_path = os.path.realpath(os.path.dirname(__file__))
root_path = os.path.join(fab_path, '..')
os.chdir(root_path)
env.slug = utils._find_slugs(slug)
if not env.slug:
utils.confirm('This post does not exist. Do you want to create a new post called %s?' % slug)
_new(slug)
return
env.static_path = '%s/%s' % (app_config.POST_PATH, env.slug)
if os.path.exists ('%s/post_config.py' % env.static_path):
# set slug for deployment in post_config
find = "DEPLOY_SLUG = ''"
replace = "DEPLOY_SLUG = '%s'" % env.slug
utils.replace_in_file('%s/post_config.py' % env.static_path, find, replace)
env.post_config = imp.load_source('post_config', '%s/post_config.py' % env.static_path)
env.copytext_key = env.post_config.COPY_GOOGLE_DOC_KEY
else:
env.post_config = None
env.copytext_key = None
env.copytext_slug = env.slug
开发者ID:BenHeubl,项目名称:lookatthis,代码行数:31,代码来源:__init__.py
示例14: create_ami
def create_ami(stackname, name=None):
pname = core.project_name_from_stackname(stackname)
msg = "this will create a new AMI for the project %r" % pname
confirm(msg)
amiid = bakery.create_ami(stackname, name)
print(amiid)
errcho('update project file with new ami %s. these changes must be merged and committed manually' % amiid)
开发者ID:elifesciences,项目名称:builder,代码行数:8,代码来源:tasks.py
示例15: deploy
def deploy(quick=None, remote='origin', reload=False):
"""
Deploy the latest app to S3 and, if configured, to our servers.
"""
require('settings', provided_by=[production, staging])
if app_config.DEPLOY_TO_SERVERS:
require('branch', provided_by=[stable, master, branch])
if (app_config.DEPLOYMENT_TARGET == 'production' and env.branch != 'stable'):
utils.confirm(
colored("You are trying to deploy the '%s' branch to production.\nYou should really only deploy a stable branch.\nDo you know what you're doing?" % env.branch, "red")
)
servers.checkout_latest(remote)
servers.fabcast('text.update')
servers.fabcast('assets.sync')
servers.fabcast('data.update')
if app_config.DEPLOY_CRONTAB:
servers.install_crontab()
if app_config.DEPLOY_SERVICES:
servers.deploy_confs()
if quick != 'quick':
update()
render.render_all()
# Clear files that should never be deployed
local('rm -rf www/live-data')
flat.deploy_folder(
app_config.S3_BUCKET,
'www',
app_config.PROJECT_SLUG,
headers={
'Cache-Control': 'max-age=%i' % app_config.DEFAULT_MAX_AGE
},
ignore=['www/assets/*', 'www/live-data/*']
)
flat.deploy_folder(
app_config.S3_BUCKET,
'www/assets',
'%s/assets' % app_config.PROJECT_SLUG,
headers={
'Cache-Control': 'max-age=%i' % app_config.ASSETS_MAX_AGE
}
)
if reload:
reset_browsers()
if not check_timestamp():
reset_browsers()
开发者ID:mroswell,项目名称:books15,代码行数:58,代码来源:__init__.py
示例16: remaster
def remaster(stackname, new_master_stackname):
"tell minion who their new master is. deletes any existing master key on minion"
# TODO: turn this into a decorator
import cfn
# start the machine if it's stopped
# you might also want to acquire a lock so alfred doesn't stop things
cfn._check_want_to_be_running(stackname, 1)
master_ip = _cached_master_ip(new_master_stackname)
LOG.info('re-mastering %s to %s', stackname, master_ip)
context = context_handler.load_context(stackname)
# remove if no longer an issue
# if context.get('ec2') == True:
# # TODO: duplicates bad ec2 data wrangling in cfngen.build_context
# # ec2 == True for some reason, which is completely useless
# LOG.warn("bad context for stack: %s", stackname)
# context['ec2'] = {}
# context['project']['aws']['ec2'] = {}
if not context.get('ec2'):
LOG.info("no ec2 context, skipping %s", stackname)
return
if context['ec2'].get('master_ip') == master_ip:
LOG.info("already remastered: %s", stackname)
try:
utils.confirm("Skip?")
return
except KeyboardInterrupt:
LOG.info("not skipping")
LOG.info("upgrading salt client")
pdata = core.project_data_for_stackname(stackname)
context['project']['salt'] = pdata['salt']
LOG.info("setting new master address")
cfngen.set_master_address(pdata, context, master_ip) # mutates context
# update context
LOG.info("updating context")
context_handler.write_context(stackname, context)
# update buildvars
LOG.info("updating buildvars")
buildvars.refresh(stackname, context)
# remove knowledge of old master
def work():
sudo("rm -f /etc/salt/pki/minion/minion_master.pub") # destroy the old master key we have
LOG.info("removing old master key from minion")
core.stack_all_ec2_nodes(stackname, work, username=config.BOOTSTRAP_USER)
# update ec2 nodes
LOG.info("updating nodes")
bootstrap.update_ec2_stack(stackname, context, concurrency='serial')
return True
开发者ID:elifesciences,项目名称:builder,代码行数:57,代码来源:master.py
示例17: install_package
def install_package(*args, **kargs):
'''Provide a string, an iterable or pass values to the
*args. Each a url or endoint used by pip
'''
v = True
for url in args:
log('installing %s' % url, color='yellow')
confirm('Would you like to install package \'%s\'' % url, True)
v = pip_install(url)
# To not have a horrible big in the future, if one package
# fails the entire procedure reports False
return v
开发者ID:hellsgate1001,项目名称:django-make,代码行数:12,代码来源:install.py
示例18: update_infrastructure
def update_infrastructure(stackname, skip=None, start=['ec2']):
"""Limited update of the Cloudformation template and/or Terraform template.
Resources can be added, but most of the existing ones are immutable.
Some resources are updatable in place.
Moreover, we never add anything related to EC2 instances as they are
not supported anyway (they will come up as part of the template
but without any software being on it)
Moreover, EC2 instances must be running while this is executed or their
resources like PublicIP will be inaccessible.
Allows to skip EC2, SQS, S3 updates by passing `skip=ec2\\,sqs\\,s3`
By default starts EC2 instances but this can be avoid by passing `start=`"""
skip = skip.split(",") if skip else []
start = start.split(",") if isinstance(start, str) else start or []
(pname, _) = core.parse_stackname(stackname)
more_context = {}
context, delta, current_context = cfngen.regenerate_stack(stackname, **more_context)
if _are_there_existing_servers(current_context) and 'ec2' in start:
core_lifecycle.start(stackname)
LOG.info("Create: %s", pformat(delta.plus))
LOG.info("Update: %s", pformat(delta.edit))
LOG.info("Delete: %s", pformat(delta.minus))
LOG.info("Terraform delta: %s", delta.terraform)
utils.confirm('Confirming changes to CloudFormation and Terraform templates?')
context_handler.write_context(stackname, context)
cloudformation.update_template(stackname, delta.cloudformation)
terraform.update_template(stackname)
# TODO: move inside bootstrap.update_stack
# EC2
if _are_there_existing_servers(context) and not 'ec2' in skip:
# the /etc/buildvars.json file may need to be updated
buildvars.refresh(stackname, context)
update(stackname)
# SQS
if context.get('sqs', {}) and not 'sqs' in skip:
bootstrap.update_stack(stackname, service_list=['sqs'])
# S3
if context.get('s3', {}) and not 's3' in skip:
bootstrap.update_stack(stackname, service_list=['s3'])
开发者ID:elifesciences,项目名称:builder,代码行数:52,代码来源:cfn.py
示例19: shiva_the_destroyer
def shiva_the_destroyer():
"""
Deletes the app from s3
"""
require('settings', provided_by=[production, staging])
utils.confirm("You are about to destroy everything deployed to %s for this project.\nDo you know what you're doing?" % app_config.DEPLOYMENT_TARGET)
with settings(warn_only=True):
sync = 'aws s3 rm %s --recursive --region "us-east-1"'
for bucket in app_config.S3_BUCKETS:
local(sync % ('s3://%s/%s/' % (bucket, app_config.PROJECT_SLUG)))
开发者ID:BenHeubl,项目名称:lookatthis,代码行数:13,代码来源:__init__.py
示例20: deploy
def deploy(slug=''):
"""
Deploy the latest app to S3 and, if configured, to our servers.
"""
require('settings', provided_by=[production, staging])
if not slug:
utils.confirm('You are about about to deploy ALL graphics. Are you sure you want to do this? (Deploy a single graphic with "deploy:SLUG".)')
render(slug)
_gzip('www', '.gzip')
_gzip(app_config.GRAPHICS_PATH, '.gzip/graphics')
_deploy_to_s3('.gzip/graphics/%s' % slug)
开发者ID:EJHale,项目名称:dailygraphics,代码行数:13,代码来源:__init__.py
注:本文中的utils.confirm函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论