From f7ae02595a6f84ecfa4e5bbac91a0b17f275482a Mon Sep 17 00:00:00 2001 From: Sawyer Bergeron Date: Thu, 15 Oct 2020 14:32:39 -0400 Subject: Fix host saving for admin utils Signed-off-by: Sawyer Bergeron Change-Id: Iff555d88b3e5489c5190e9295bef4b0e1da92b5a --- src/dashboard/admin_utils.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/dashboard/admin_utils.py b/src/dashboard/admin_utils.py index 050f246..367c613 100644 --- a/src/dashboard/admin_utils.py +++ b/src/dashboard/admin_utils.py @@ -58,11 +58,15 @@ def book_host(owner_username, host_labid, lab_username, hostname, image_id, temp host.bundle = resource_bundle host.config = config rmanager.configureNetworking(resource_bundle, host, vlan_map) + host.save() except Exception: host.booked = False + host.save() print("Failed to book host due to error configuring it") return + new_template.save() + booking = Booking.objects.create( purpose=purpose, project=project, @@ -76,6 +80,8 @@ def book_host(owner_username, host_labid, lab_username, hostname, image_id, temp booking.pdf = PDFTemplater.makePDF(booking) + booking.save() + for collaborator_username in collaborator_usernames: try: user = User.objects.get(username=collaborator_username) -- cgit 1.2.3-korg