本文整理汇总了Python中OSConf.add_app方法的典型用法代码示例。如果您正苦于以下问题:Python OSConf.add_app方法的具体用法?Python OSConf.add_app怎么用?Python OSConf.add_app使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类OSConf
的用法示例。
在下文中一共展示了OSConf.add_app方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: create_app
# 需要导入模块: import OSConf [as 别名]
# 或者: from OSConf import add_app [as 别名]
def create_app(app_name, app_type, user_email=None, user_passwd=None,
clone_repo=True, git_repo="./", scalable=False,
gear_size = "small", timeout=None,
disable_autoscaling=True):
if user_email is None:
(user_email, user_passwd) = get_default_rhlogin()
if clone_repo == True:
if git_repo == "./":
options = ""
cmd = "ls %s" % (app_name)
else:
options = "-r %s" %(git_repo)
cmd = "ls %s" % (git_repo)
else:
options = "--no-git"
cmd = "true"
try:
if os.path.exists(app_name):
shutil.rmtree(app_name)
except:
pass
cmd = ("rhc app create %s %s -l %s -p %s"
" %s %s")% (app_name, app_type,
user_email, user_passwd,
options, RHTEST_RHC_CLIENT_OPTIONS)
if scalable:
cmd += " -s "
if gear_size != "small":
cmd += " -g %s " % ( gear_size )
(ret, output) = command_getstatusoutput(cmd, quiet=False)
if ret == 0:
if not isDNS(output):
OSConf.add_app(app_name, app_type, output)
else:
log.info("DNS issue - try to update cache via REST API")
OSConf.add_app(app_name, app_type, output)
else:
print "ERROR!\n",output
if is500(output): #or isDNS(output):
raise MercyException("500")
return ret
if scalable and disable_autoscaling:
if clone_repo:
touch(os.path.join(app_name,".openshift/markers/disable_auto_scaling"))
cmd = "cd %s && git add . && git commit -amt && git push" % (app_name)
log.debug("Disabling autoscaling...")
(retcode, output) = command_getstatusoutput(cmd, quiet = True)
if retcode != 0:
log.error("Unable to disable autoscaling: %s"%output)
else:
log.warning("Unable to disable autoscaling->disabled clone_repo")
if app_type == app_types['jenkins']:
print 'Waiting for jenkins server to get ready...'
time.sleep(30)
return ret