mirror of
https://github.com/ansible/awx.git
synced 2026-04-04 17:55:06 -02:30
Secondaries should not have schedules.
This commit is contained in:
@@ -198,9 +198,9 @@ def rebuild_graph(message):
|
|||||||
# NOTE: Pull status again and make sure it didn't finish in
|
# NOTE: Pull status again and make sure it didn't finish in
|
||||||
# the meantime?
|
# the meantime?
|
||||||
task.status = 'failed'
|
task.status = 'failed'
|
||||||
task.job_explanation += ''.join((
|
task.job_explanation += ' '.join((
|
||||||
'Task was marked as running in Tower but was not present in',
|
'Task was marked as running in Tower but was not present in',
|
||||||
'Celery so it has been marked as failed',
|
'Celery, so it has been marked as failed.',
|
||||||
))
|
))
|
||||||
task.save()
|
task.save()
|
||||||
task.socketio_emit_status("failed")
|
task.socketio_emit_status("failed")
|
||||||
|
|||||||
@@ -39,7 +39,7 @@ from django.utils.timezone import now
|
|||||||
# AWX
|
# AWX
|
||||||
from awx.main.constants import CLOUD_PROVIDERS
|
from awx.main.constants import CLOUD_PROVIDERS
|
||||||
from awx.main.models import * # Job, JobEvent, ProjectUpdate, InventoryUpdate,
|
from awx.main.models import * # Job, JobEvent, ProjectUpdate, InventoryUpdate,
|
||||||
# Schedule, UnifiedJobTemplate
|
# Schedule, UnifiedJobTemplate, Instance
|
||||||
from awx.main.queue import FifoQueue
|
from awx.main.queue import FifoQueue
|
||||||
from awx.main.utils import (get_ansible_version, decrypt_field, update_scm_url,
|
from awx.main.utils import (get_ansible_version, decrypt_field, update_scm_url,
|
||||||
ignore_inventory_computed_fields, emit_websocket_notification,
|
ignore_inventory_computed_fields, emit_websocket_notification,
|
||||||
@@ -87,6 +87,12 @@ def tower_periodic_scheduler(self):
|
|||||||
return
|
return
|
||||||
logger.debug("Last run was: %s", last_run)
|
logger.debug("Last run was: %s", last_run)
|
||||||
write_last_run(run_now)
|
write_last_run(run_now)
|
||||||
|
|
||||||
|
# Sanity check: If this is a secondary machine, there is nothing
|
||||||
|
# on the schedule.
|
||||||
|
if Instance.objects.my_role() == 'secondary':
|
||||||
|
return
|
||||||
|
|
||||||
old_schedules = Schedule.objects.enabled().before(last_run)
|
old_schedules = Schedule.objects.enabled().before(last_run)
|
||||||
for schedule in old_schedules:
|
for schedule in old_schedules:
|
||||||
schedule.save()
|
schedule.save()
|
||||||
|
|||||||
Reference in New Issue
Block a user