aboutsummaryrefslogtreecommitdiffstats
path: root/src/api/views.py
diff options
context:
space:
mode:
authorParker Berberian <pberberian@iol.unh.edu>2019-03-12 10:28:48 -0400
committerParker Berberian <pberberian@iol.unh.edu>2019-03-12 10:28:48 -0400
commite00d336aeb6da542d8a54f157ab2e285cd4a3e57 (patch)
tree32556fa89bd500183b30a2ef1601c600db422ecb /src/api/views.py
parent36c012ef86233a323434be5e4c6de524188591e9 (diff)
Allow labs to retirieve and update some host information in the api
Change-Id: Ib0682141351f7789c50d98a992ab166c2f033f4b Signed-off-by: Parker Berberian <pberberian@iol.unh.edu>
Diffstat (limited to 'src/api/views.py')
-rw-r--r--src/api/views.py12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/api/views.py b/src/api/views.py
index 90f87d9..a56dcfe 100644
--- a/src/api/views.py
+++ b/src/api/views.py
@@ -54,6 +54,16 @@ def lab_inventory(request, lab_name=""):
return JsonResponse(lab_manager.get_inventory(), safe=False)
+@csrf_exempt
+def lab_host(request, lab_name="", host_id=""):
+ lab_token = request.META.get('HTTP_AUTH_TOKEN')
+ lab_manager = LabManagerTracker.get(lab_name, lab_token)
+ if request.method == "GET":
+ return JsonResponse(lab_manager.get_host(host_id), safe=False)
+ if request.method == "POST":
+ return JsonResponse(lab_manager.update_host(host_id, request.POST), safe=False)
+
+
def lab_status(request, lab_name=""):
lab_token = request.META.get('HTTP_AUTH_TOKEN')
lab_manager = LabManagerTracker.get(lab_name, lab_token)
@@ -62,6 +72,7 @@ def lab_status(request, lab_name=""):
return JsonResponse(lab_manager.get_status(), safe=False)
+@csrf_exempt
def update_host_bmc(request, lab_name="", host_id=""):
lab_token = request.META.get('HTTP_AUTH_TOKEN')
lab_manager = LabManagerTracker.get(lab_name, lab_token)
@@ -104,6 +115,7 @@ def specific_task(request, lab_name="", job_id="", task_id=""):
return JsonResponse(get_task(task_id).config.get_delta())
+@csrf_exempt
def specific_job(request, lab_name="", job_id=""):
lab_token = request.META.get('HTTP_AUTH_TOKEN')
lab_manager = LabManagerTracker.get(lab_name, lab_token)