mirror of
https://github.com/ansible/awx.git
synced 2026-05-17 22:37:41 -02:30
Support passing the schedule when signaling start so we record which
schedule this came from
This commit is contained in:
@@ -676,13 +676,13 @@ class InventorySource(UnifiedJobTemplate, InventorySourceOptions):
|
|||||||
inventory_update_sig = inventory_update.start_signature()
|
inventory_update_sig = inventory_update.start_signature()
|
||||||
return (inventory_update, inventory_update_sig)
|
return (inventory_update, inventory_update_sig)
|
||||||
|
|
||||||
def update(self, **kwargs):
|
def update(self, schedule=None, **kwargs):
|
||||||
if self.can_update:
|
if self.can_update:
|
||||||
inventory_update = self.create_inventory_update()
|
inventory_update = self.create_inventory_update()
|
||||||
if hasattr(settings, 'CELERY_UNIT_TEST'):
|
if hasattr(settings, 'CELERY_UNIT_TEST'):
|
||||||
inventory_update.start(None, **kwargs)
|
inventory_update.start(None, **kwargs)
|
||||||
else:
|
else:
|
||||||
inventory_update.signal_start(**kwargs)
|
inventory_update.signal_start(schedule=schedule, **kwargs)
|
||||||
return inventory_update
|
return inventory_update
|
||||||
|
|
||||||
|
|
||||||
@@ -736,8 +736,11 @@ class InventoryUpdate(UnifiedJob, InventorySourceOptions):
|
|||||||
def task_impact(self):
|
def task_impact(self):
|
||||||
return 50
|
return 50
|
||||||
|
|
||||||
def signal_start(self, **kwargs):
|
def signal_start(self, schedule=None, **kwargs):
|
||||||
from awx.main.tasks import notify_task_runner
|
from awx.main.tasks import notify_task_runner
|
||||||
|
if schedule:
|
||||||
|
self.schedule=schedule
|
||||||
|
self.save()
|
||||||
if not self.can_start:
|
if not self.can_start:
|
||||||
return False
|
return False
|
||||||
needed = self._get_passwords_needed_to_start()
|
needed = self._get_passwords_needed_to_start()
|
||||||
|
|||||||
@@ -319,8 +319,11 @@ class Job(UnifiedJob, JobOptions):
|
|||||||
dependencies.append(source.create_inventory_update(launch_type='dependency'))
|
dependencies.append(source.create_inventory_update(launch_type='dependency'))
|
||||||
return dependencies
|
return dependencies
|
||||||
|
|
||||||
def signal_start(self, **kwargs):
|
def signal_start(self, schedule=None, **kwargs):
|
||||||
from awx.main.tasks import notify_task_runner
|
from awx.main.tasks import notify_task_runner
|
||||||
|
if schedule:
|
||||||
|
self.schedule = schedule
|
||||||
|
self.save()
|
||||||
if hasattr(settings, 'CELERY_UNIT_TEST'):
|
if hasattr(settings, 'CELERY_UNIT_TEST'):
|
||||||
return self.start(None, **kwargs)
|
return self.start(None, **kwargs)
|
||||||
if not self.can_start:
|
if not self.can_start:
|
||||||
|
|||||||
@@ -312,13 +312,13 @@ class Project(UnifiedJobTemplate, ProjectOptions):
|
|||||||
project_update_sig = project_update.start_signature()
|
project_update_sig = project_update.start_signature()
|
||||||
return (project_update, project_update_sig)
|
return (project_update, project_update_sig)
|
||||||
|
|
||||||
def update(self, **kwargs):
|
def update(self, schedule=None, **kwargs):
|
||||||
if self.can_update:
|
if self.can_update:
|
||||||
project_update = self.create_project_update()
|
project_update = self.create_project_update()
|
||||||
if hasattr(settings, 'CELERY_UNIT_TEST'):
|
if hasattr(settings, 'CELERY_UNIT_TEST'):
|
||||||
project_update.start(None, **kwargs)
|
project_update.start(None, **kwargs)
|
||||||
else:
|
else:
|
||||||
project_update.signal_start(**kwargs)
|
project_update.signal_start(schedule=schedule, **kwargs)
|
||||||
return project_update
|
return project_update
|
||||||
|
|
||||||
def get_absolute_url(self):
|
def get_absolute_url(self):
|
||||||
@@ -359,8 +359,11 @@ class ProjectUpdate(UnifiedJob, ProjectOptions):
|
|||||||
def task_impact(self):
|
def task_impact(self):
|
||||||
return 20
|
return 20
|
||||||
|
|
||||||
def signal_start(self, **kwargs):
|
def signal_start(self, schedule=None, **kwargs):
|
||||||
from awx.main.tasks import notify_task_runner
|
from awx.main.tasks import notify_task_runner
|
||||||
|
if schedule:
|
||||||
|
self.schedule = schedule
|
||||||
|
self.save()
|
||||||
if not self.can_start:
|
if not self.can_start:
|
||||||
return False
|
return False
|
||||||
needed = self._get_passwords_needed_to_start()
|
needed = self._get_passwords_needed_to_start()
|
||||||
|
|||||||
Reference in New Issue
Block a user