diff options
author | Sawyer Bergeron <sbergeron@iol.unh.edu> | 2020-10-15 14:32:39 -0400 |
---|---|---|
committer | Sawyer Bergeron <sbergeron@iol.unh.edu> | 2020-10-15 14:32:39 -0400 |
commit | f7ae02595a6f84ecfa4e5bbac91a0b17f275482a (patch) | |
tree | ba4af6a28be5c5513c7adcc23b64b67e8965226b /src | |
parent | 7282289e63a9c2f5072b205cf41b8e979fd1d7e0 (diff) |
Fix host saving for admin utils
Signed-off-by: Sawyer Bergeron <sbergeron@iol.unh.edu>
Change-Id: Iff555d88b3e5489c5190e9295bef4b0e1da92b5a
Diffstat (limited to 'src')
-rw-r--r-- | src/dashboard/admin_utils.py | 6 |
1 files changed, 6 insertions, 0 deletions
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) |