From 3ad9229ea91c3ce572ceea4206a4b42f1d9d0b9f Mon Sep 17 00:00:00 2001 From: Chris Meyers Date: Mon, 23 Feb 2015 13:23:12 -0500 Subject: [PATCH] bandaid for scm_delete_on_next_update save issue --- awx/main/models/unified_jobs.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/awx/main/models/unified_jobs.py b/awx/main/models/unified_jobs.py index 00df267fec..8cd4f7b9a5 100644 --- a/awx/main/models/unified_jobs.py +++ b/awx/main/models/unified_jobs.py @@ -231,7 +231,15 @@ class UnifiedJobTemplate(PolymorphicModel, CommonModelNameNotUnique): if field not in update_fields: update_fields.append(field) # Do the actual save. - super(UnifiedJobTemplate, self).save(*args, **kwargs) + try: + super(UnifiedJobTemplate, self).save(*args, **kwargs) + except ValueError: + # A fix for https://trello.com/c/S4rU1F21 + # Does not resolve the root cause. Tis merely a bandaid. + if 'scm_delete_on_next_update' in update_fields: + update_fields.remove('scm_delete_on_next_update') + super(UnifiedJobTemplate, self).save(*args, **kwargs) + def _get_current_status(self): # Override in subclasses as needed.