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'})
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
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
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'})