本文整理汇总了Python中models.Config.cluster_etcd_locator_url方法的典型用法代码示例。如果您正苦于以下问题:Python Config.cluster_etcd_locator_url方法的具体用法?Python Config.cluster_etcd_locator_url怎么用?Python Config.cluster_etcd_locator_url使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类models.Config
的用法示例。
在下文中一共展示了Config.cluster_etcd_locator_url方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: addclusterconfig
# 需要导入模块: from models import Config [as 别名]
# 或者: from models.Config import cluster_etcd_locator_url [as 别名]
def addclusterconfig():
print request
if request.method == 'POST':
# save a new config
nc = Config()
nc.cluster_name = request.form['cluster_name']
nc.cluster_etcd_locator_url = request.form['cluster_etcd_locator_url']
nc.private_key = request.form['primary_key']
db.session.add(nc)
db.session.commit()
return json.dumps({'status': 'OK', 'cluster': {'id': nc.id, 'cluster_name': nc.cluster_name,
'cluster_etcd_locator_url': nc.cluster_etcd_locator_url}})
else:
print request
示例2: newclusterconfig
# 需要导入模块: from models import Config [as 别名]
# 或者: from models.Config import cluster_etcd_locator_url [as 别名]
def newclusterconfig():
print request
tokenUrl = "https://discovery.etcd.io/new"
if request.method == 'POST':
# save a new config
nc = Config()
nc.cluster_name = request.form['cluster_name']
try:
# create the new token
r = requests.get(tokenUrl)
cluster_etcd_locator_url = r.text
nc.cluster_etcd_locator_url = cluster_etcd_locator_url
db.session.add(nc)
db.session.commit()
except Exception:
pass
return json.dumps({'status': 'OK','cluster': {'id': nc.id, 'cluster_name': nc.cluster_name,
'cluster_etcd_locator_url': nc.cluster_etcd_locator_url}})
else:
return json.dumps({'status': 'Fail'})