mirror of
https://github.com/ansible/awx.git
synced 2026-02-26 23:46:05 -03:30
inherit child job finish status
This commit is contained in:
@@ -1101,6 +1101,7 @@ class InventorySource(UnifiedJobTemplate, InventorySourceOptions):
|
|||||||
'credential', 'source_regions', 'instance_filters', 'group_by', 'overwrite', 'overwrite_vars']
|
'credential', 'source_regions', 'instance_filters', 'group_by', 'overwrite', 'overwrite_vars']
|
||||||
|
|
||||||
def save(self, *args, **kwargs):
|
def save(self, *args, **kwargs):
|
||||||
|
print("Inventory source save called <%s, %s>" % (self.pk, self.status))
|
||||||
new_instance = bool(self.pk)
|
new_instance = bool(self.pk)
|
||||||
# If update_fields has been specified, add our field names to it,
|
# If update_fields has been specified, add our field names to it,
|
||||||
# if it hasn't been specified, then we're just doing a normal save.
|
# if it hasn't been specified, then we're just doing a normal save.
|
||||||
@@ -1143,10 +1144,9 @@ class InventorySource(UnifiedJobTemplate, InventorySourceOptions):
|
|||||||
return self.current_job.status
|
return self.current_job.status
|
||||||
elif not self.last_job:
|
elif not self.last_job:
|
||||||
return 'never updated'
|
return 'never updated'
|
||||||
elif self.last_job_failed:
|
# inherit the child job status
|
||||||
return 'failed'
|
|
||||||
else:
|
else:
|
||||||
return 'successful'
|
return self.last_job.status
|
||||||
else:
|
else:
|
||||||
return 'none'
|
return 'none'
|
||||||
|
|
||||||
@@ -1231,6 +1231,9 @@ class InventoryUpdate(UnifiedJob, InventorySourceOptions):
|
|||||||
self.license_error = True
|
self.license_error = True
|
||||||
if 'license_error' not in update_fields:
|
if 'license_error' not in update_fields:
|
||||||
update_fields.append('license_error')
|
update_fields.append('license_error')
|
||||||
|
|
||||||
|
if 'status' in update_fields:
|
||||||
|
print("Calling inherited parent save for InventoryUpdate <%s, %s>" % (self.pk, self.status))
|
||||||
super(InventoryUpdate, self).save(*args, **kwargs)
|
super(InventoryUpdate, self).save(*args, **kwargs)
|
||||||
|
|
||||||
def get_absolute_url(self):
|
def get_absolute_url(self):
|
||||||
|
|||||||
@@ -253,12 +253,16 @@ class Project(UnifiedJobTemplate, ProjectOptions):
|
|||||||
return self.current_job.status
|
return self.current_job.status
|
||||||
elif not self.last_job:
|
elif not self.last_job:
|
||||||
return 'never updated'
|
return 'never updated'
|
||||||
|
# inherit the child job status on failure
|
||||||
elif self.last_job_failed:
|
elif self.last_job_failed:
|
||||||
return 'failed'
|
return self.last_job.status
|
||||||
|
# Even on a successful child run, a missing project path overides
|
||||||
|
# the successful status
|
||||||
elif not self.get_project_path():
|
elif not self.get_project_path():
|
||||||
return 'missing'
|
return 'missing'
|
||||||
|
# Return the successful status
|
||||||
else:
|
else:
|
||||||
return 'successful'
|
return self.last_job.status
|
||||||
elif not self.get_project_path():
|
elif not self.get_project_path():
|
||||||
return 'missing'
|
return 'missing'
|
||||||
else:
|
else:
|
||||||
@@ -353,6 +357,7 @@ class ProjectUpdate(UnifiedJob, ProjectOptions):
|
|||||||
return reverse('api:project_update_detail', args=(self.pk,))
|
return reverse('api:project_update_detail', args=(self.pk,))
|
||||||
|
|
||||||
def _update_parent_instance(self):
|
def _update_parent_instance(self):
|
||||||
|
print("This should not print")
|
||||||
parent_instance = self._get_parent_instance()
|
parent_instance = self._get_parent_instance()
|
||||||
if parent_instance:
|
if parent_instance:
|
||||||
update_fields = self._update_parent_instance_no_save(parent_instance)
|
update_fields = self._update_parent_instance_no_save(parent_instance)
|
||||||
|
|||||||
Reference in New Issue
Block a user