mirror of
https://github.com/ansible/awx.git
synced 2026-01-16 12:20:45 -03:30
AC-1158 Fix project to set delete on next update.
This commit is contained in:
parent
be8986bf4e
commit
59dc2a2cb8
@ -292,9 +292,12 @@ class Project(UnifiedJobTemplate, ProjectOptions):
|
||||
def _can_update(self):
|
||||
return bool(self.scm_type)
|
||||
|
||||
def create_project_update(self, **kwargs):
|
||||
def _update_unified_job_kwargs(self, **kwargs):
|
||||
if self.scm_delete_on_next_update:
|
||||
kwargs['scm_delete_on_update'] = True
|
||||
return kwargs
|
||||
|
||||
def create_project_update(self, **kwargs):
|
||||
return self.create_unified_job(**kwargs)
|
||||
|
||||
@property
|
||||
|
||||
@ -254,6 +254,12 @@ class UnifiedJobTemplate(PolymorphicModel, CommonModelNameNotUnique):
|
||||
'''
|
||||
raise NotImplementedError # Implement in subclass.
|
||||
|
||||
def _update_unified_job_kwargs(self, **kwargs):
|
||||
'''
|
||||
Hook for subclasses to update kwargs.
|
||||
'''
|
||||
return kwargs # Override if needed in subclass.
|
||||
|
||||
def create_unified_job(self, **kwargs):
|
||||
'''
|
||||
Create a new unified job based on this unified job template.
|
||||
@ -270,6 +276,7 @@ class UnifiedJobTemplate(PolymorphicModel, CommonModelNameNotUnique):
|
||||
if hasattr(self, '%s_id' % field_name) and ('%s_id' % field_name) in kwargs:
|
||||
continue
|
||||
kwargs[field_name] = getattr(self, field_name)
|
||||
kwargs = self._update_unified_job_kwargs(**kwargs)
|
||||
unified_job = unified_job_class(**kwargs)
|
||||
if save_unified_job:
|
||||
unified_job.save()
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user