1
0
Fork 0
mirror of https://github.com/ThomasGsp/HyperProxmox.git synced 2025-03-09 15:40:18 +00:00

General update

This commit is contained in:
thomas.guiseppin 2017-10-29 18:00:00 +01:00
parent e283d0f2f7
commit f0e67d1aed
2 changed files with 51 additions and 25 deletions

View file

@ -11,6 +11,12 @@ import random
import ast
def cooktheticket(ticket, action, target):
if ticket == "aaa":
return True
else:
return False
class Auth:
def POST(self):
# '{"username":"fff", "password":"azerty"}'
@ -19,8 +25,12 @@ class Auth:
# Test Login
# If true generate an ticket
# use date and ip
i = web.input(ticket='aaa')
web.setcookie('ticket', i.ticket, 3600)
return
class Cluster:
def GET(self, cluster=None):
try:
@ -72,21 +82,20 @@ class Cluster:
return result
# Ajouter le retour d'erreur des requetes foireuses
class Instance:
def GET(self, vmid=None, status=None):
try:
if status:
""" GET INSTANCE STATUS """
result = core.status_instance(vmid, status)
elif vmid:
else:
""" GET INSTANCE INFORMATION """
result = core.info_instance(vmid)
except BaseException as e:
result = {
"result": "ERROR",
"type": "PYTHON - API",
"value": "{0} {1}".format("Invalid request:", e)
"value": "Invalid request: {0}".format(e)
}
return result