mirror of
https://github.com/ThomasGsp/HyperProxmox.git
synced 2025-03-09 15:40:18 +00:00
- Change api syntax to insert a new cluster
This commit is contained in:
parent
5934999c9f
commit
2a621a56b6
1 changed files with 6 additions and 2 deletions
|
@ -11,6 +11,7 @@ import random
|
||||||
import ast
|
import ast
|
||||||
|
|
||||||
|
|
||||||
|
""" --------- TMP PART --------- """
|
||||||
|
|
||||||
allowed = (
|
allowed = (
|
||||||
('jon','pass1'),
|
('jon','pass1'),
|
||||||
|
@ -39,10 +40,12 @@ class Login:
|
||||||
else:
|
else:
|
||||||
authreq = True
|
authreq = True
|
||||||
if authreq:
|
if authreq:
|
||||||
web.header('WWW-Authenticate','Basic realm="Auth HyperProxmox API"')
|
web.header('WWW-Authenticate', 'Basic realm="Auth HyperProxmox API"')
|
||||||
web.ctx.status = '401 Unauthorized'
|
web.ctx.status = '401 Unauthorized'
|
||||||
return
|
return
|
||||||
|
|
||||||
|
""" ------------------- """
|
||||||
|
|
||||||
""" CLASS MONGO CACHE """
|
""" CLASS MONGO CACHE """
|
||||||
class General_Search:
|
class General_Search:
|
||||||
def GET(self, query, id):
|
def GET(self, query, id):
|
||||||
|
@ -107,9 +110,10 @@ class Cluster:
|
||||||
|
|
||||||
return json.dumps(result)
|
return json.dumps(result)
|
||||||
|
|
||||||
def POST(self):
|
def POST(self, cluster):
|
||||||
try:
|
try:
|
||||||
data = json.loads(web.data().decode('utf-8'))
|
data = json.loads(web.data().decode('utf-8'))
|
||||||
|
data["name"] = cluster
|
||||||
result = core.insert_clusters_conf(data)
|
result = core.insert_clusters_conf(data)
|
||||||
except BaseException as e:
|
except BaseException as e:
|
||||||
result = {
|
result = {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue