diff options
author | Justin Choquette <jchoquette@iol.unh.edu> | 2023-10-23 16:24:13 -0400 |
---|---|---|
committer | Justin Choquette <jchoquette@iol.unh.edu> | 2023-10-25 16:26:17 -0400 |
commit | a4ba880252b2bad72df3f16dd11fdf2206825335 (patch) | |
tree | 3d2852284728814ba546ae2719f47fe641b0f544 /src/liblaas | |
parent | aff53e072502d63d8002d9c83213ce7f9d12c352 (diff) |
Single Template Selection For Compatible Dashboardsliblaas-mvp
Change-Id: I0a795c2c49fdbe0427182a8789d622003997efcd
Signed-off-by: Justin Choquette <jchoquette@iol.unh.edu>
Diffstat (limited to 'src/liblaas')
-rw-r--r-- | src/liblaas/endpoints.py | 3 | ||||
-rw-r--r-- | src/liblaas/views.py | 17 |
2 files changed, 5 insertions, 15 deletions
diff --git a/src/liblaas/endpoints.py b/src/liblaas/endpoints.py index 64e5126..55611f3 100644 --- a/src/liblaas/endpoints.py +++ b/src/liblaas/endpoints.py @@ -18,6 +18,7 @@ from booking.models import Booking from account.models import Lab from django.utils import timezone from datetime import timedelta +from laas_dashboard.settings import PROJECT def request_list_flavors(request) -> HttpResponse: data = json.loads(request.body.decode('utf-8')) @@ -90,7 +91,7 @@ def request_create_booking(request) -> HttpResponse: "project": data["metadata"]["project"], "length": int(data["metadata"]["length"]) }, - "origin": "anuket" if os.environ.get("TEMPLATE_OVERRIDE_DIR") == 'laas' else "lfedge" # todo - refactor + "origin": PROJECT } # Create booking in dashboard diff --git a/src/liblaas/views.py b/src/liblaas/views.py index 5edc727..8eb1dd0 100644 --- a/src/liblaas/views.py +++ b/src/liblaas/views.py @@ -75,19 +75,8 @@ def flavor_list_flavors(project: str) -> requests.Response: return None # GET -def flavor_get_flavor_by_id(flavor_id: str) -> requests.Response: - endpoint = f'flavor/name/{flavor_id}/' - url = f'{base}{endpoint}' - try: - response = requests.get(url) - return response.json() - except: - print(f"Error at {url}") - return None - -# GET def flavor_list_hosts(project: str) -> requests.Response: - endpoint = f'flavor/hosts/{project}' + endpoint = f'flavor/hosts/{project}' #todo - support project in liblaas url = f'{base}{endpoint}' try: response = requests.get(url) @@ -100,7 +89,7 @@ def flavor_list_hosts(project: str) -> requests.Response: # GET def template_list_templates(uid: str) -> requests.Response: - endpoint = f'template/list/{uid}' + endpoint = f'template/list/{uid}' # todo - templates need to be restricted by project url = f'{base}{endpoint}' try: response = requests.get(url) @@ -122,7 +111,7 @@ def template_delete_template(template_id: str) -> requests.Response: #POST def template_make_template(template_blob: dict) -> requests.Response: - endpoint = f'template/create' + endpoint = f'template/create' # todo - needs to be restricted by project url = f'{base}{endpoint}' try: response = requests.post(url, data=json.dumps(template_blob), headers=post_headers) |