diff options
author | Parker Berberian <pberberian@iol.unh.edu> | 2019-01-17 12:51:04 -0500 |
---|---|---|
committer | Parker Berberian <pberberian@iol.unh.edu> | 2019-01-18 16:08:27 -0500 |
commit | 8483acb4c4e8c758855f2184483af834977b0c52 (patch) | |
tree | 403618bb77d4f19c2a7b908bb8a0872f144d530b /dashboard/src/workflow/models.py | |
parent | be3825307c7a44f1491e85e33fd0a0ecf1e95a1d (diff) |
OverHaul the Snapshot Workflow
Makes the Snapshot workflow much prettier and more functional.
Change-Id: Icdd66f64e6d336ad49ed3cf638a301d0ca92fda9
Signed-off-by: Parker Berberian <pberberian@iol.unh.edu>
Diffstat (limited to 'dashboard/src/workflow/models.py')
-rw-r--r-- | dashboard/src/workflow/models.py | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/dashboard/src/workflow/models.py b/dashboard/src/workflow/models.py index 495ce07..4e79546 100644 --- a/dashboard/src/workflow/models.py +++ b/dashboard/src/workflow/models.py @@ -11,6 +11,7 @@ from django.shortcuts import render from django.contrib import messages from django.http import HttpResponse +from django.utils import timezone import yaml import requests @@ -385,6 +386,8 @@ class Repository(): if not booking_id: return "SNAP, No booking ID provided" booking = Booking.objects.get(pk=booking_id) + if booking.start > timezone.now() or booking.end < timezone.now(): + return "Booking is not active" name = self.el.get(self.SNAPSHOT_NAME) if not name: return "SNAP, no name provided" @@ -400,6 +403,13 @@ class Repository(): image.owner = owner image.host_type = host.profile image.save() + try: + current_image = host.config.image + image.os = current_image.os + image.save() + except Exception: + pass + JobFactory.makeSnapshotTask(image, booking, host) def make_generic_resource_bundle(self): owner = self.el[self.SESSION_USER] |