From 30dde45dbf5b47b7d4c18ed87779b2b2f2fec214 Mon Sep 17 00:00:00 2001 From: Parker Berberian Date: Thu, 17 Jan 2019 12:51:04 -0500 Subject: OverHaul the Snapshot Workflow Makes the Snapshot workflow much prettier and more functional. Change-Id: Icdd66f64e6d336ad49ed3cf638a301d0ca92fda9 Signed-off-by: Parker Berberian --- src/workflow/models.py | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'src/workflow/models.py') diff --git a/src/workflow/models.py b/src/workflow/models.py index 495ce07..4e79546 100644 --- a/src/workflow/models.py +++ b/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] -- cgit 1.2.3-korg