From: Sawyer Bergeron Date: Thu, 15 Oct 2020 18:32:39 +0000 (-0400) Subject: Fix host saving for admin utils X-Git-Tag: 2.0.99~2 X-Git-Url: https://gerrit.opnfv.org/gerrit/gitweb?a=commitdiff_plain;h=refs%2Fchanges%2F58%2F71258%2F1;p=laas.git Fix host saving for admin utils Signed-off-by: Sawyer Bergeron Change-Id: Iff555d88b3e5489c5190e9295bef4b0e1da92b5a --- 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)