From b69f56ecb84acf84593f0412ace95e84121cd809 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adolfo=20G=C3=B3mez=20Garc=C3=ADa?= Date: Tue, 24 Mar 2015 11:22:28 +0100 Subject: [PATCH] Fixed servicepool deletion on image deletion --- server/src/uds/models/Image.py | 3 --- server/src/uds/models/ServicesPool.py | 4 ++-- 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/server/src/uds/models/Image.py b/server/src/uds/models/Image.py index 32e344b84..ba3095245 100644 --- a/server/src/uds/models/Image.py +++ b/server/src/uds/models/Image.py @@ -187,9 +187,6 @@ class Image(UUIDModel): :note: If destroy raises an exception, the deletion is not taken. ''' toDelete = kwargs['instance'] - toDelete.deployedServices.update(image=None) - - # Todelete is a group logger.debug('Deleted image {0}'.format(toDelete)) diff --git a/server/src/uds/models/ServicesPool.py b/server/src/uds/models/ServicesPool.py index e41eddb06..8c9f5d75b 100644 --- a/server/src/uds/models/ServicesPool.py +++ b/server/src/uds/models/ServicesPool.py @@ -33,7 +33,7 @@ from __future__ import unicode_literals -__updated__ = '2015-02-01' +__updated__ = '2015-03-24' from django.db import models from django.db.models import signals @@ -75,7 +75,7 @@ class DeployedService(UUIDModel): state = models.CharField(max_length=1, default=State.ACTIVE, db_index=True) state_date = models.DateTimeField(default=NEVER) show_transports = models.BooleanField(default=True) - image = models.ForeignKey(Image, null=True, blank=True, related_name='deployedServices') + image = models.ForeignKey(Image, null=True, blank=True, related_name='deployedServices', on_delete=models.SET_NULL) initial_srvs = models.PositiveIntegerField(default=0) cache_l1_srvs = models.PositiveIntegerField(default=0) cache_l2_srvs = models.PositiveIntegerField(default=0)