本文整理汇总了Python中OSConf.setup_by_rest方法的典型用法代码示例。如果您正苦于以下问题:Python OSConf.setup_by_rest方法的具体用法?Python OSConf.setup_by_rest怎么用?Python OSConf.setup_by_rest使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类OSConf
的用法示例。
在下文中一共展示了OSConf.setup_by_rest方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: create_scalable_app2
# 需要导入模块: import OSConf [as 别名]
# 或者: from OSConf import setup_by_rest [as 别名]
def create_scalable_app2(app_name, app_type, user_email=None, user_passwd=None,
clone_repo=True, git_repo="./", gear_size="small",
disable_autoscaling=True):
"""Create app with REST API"""
if user_email is None:
(user_email, user_passwd) = get_default_rhlogin()
rest = openshift.Openshift(host=get_instance_ip(),
user=user_email,
passwd=user_passwd)
(status, response) = rest.app_create_scale(app_name, app_type)
if status in ('OK', 'Created'):
OSConf.setup_by_rest()
if clone_repo:
git_clone_app(app_name)
if 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")
else:
log.error(response)
if status in ('OK', 'Created'):
return 0
else:
return 1
示例2: create_app2
# 需要导入模块: import OSConf [as 别名]
# 或者: from OSConf import setup_by_rest [as 别名]
def create_app2(app_name, app_type, user_email=None, user_passwd=None,
clone_repo=True, git_repo="./", scalable=False,
gear_size = "small", disable_autoscaling=True):
"""Similar as craate_app but with using REST API"""
if user_email is None:
(user_email, user_passwd) = get_default_rhlogin()
rest = openshift.Openshift(host=get_instance_ip(),
user=user_email,
passwd=user_passwd)
if scalable:
scalable = 'true'
else:
scalable = 'false'
(status, response) = rest.app_create_scale(app_name, app_type, scalable)
if status in ('Created', 'OK'):
OSConf.setup_by_rest()
if clone_repo:
git_clone_app(app_name)
return 0
else:
return 1