Secondaries should not have schedules.

This commit is contained in:
Luke Sneeringer 2014-12-17 15:33:14 -06:00
parent d4879506c2
commit fd6eb66b20
2 changed files with 9 additions and 3 deletions

View File

@ -198,9 +198,9 @@ def rebuild_graph(message):
# NOTE: Pull status again and make sure it didn't finish in
# the meantime?
task.status = 'failed'
task.job_explanation += ''.join((
task.job_explanation += ' '.join((
'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.socketio_emit_status("failed")

View File

@ -39,7 +39,7 @@ from django.utils.timezone import now
# AWX
from awx.main.constants import CLOUD_PROVIDERS
from awx.main.models import * # Job, JobEvent, ProjectUpdate, InventoryUpdate,
# Schedule, UnifiedJobTemplate
# Schedule, UnifiedJobTemplate, Instance
from awx.main.queue import FifoQueue
from awx.main.utils import (get_ansible_version, decrypt_field, update_scm_url,
ignore_inventory_computed_fields, emit_websocket_notification,
@ -87,6 +87,12 @@ def tower_periodic_scheduler(self):
return
logger.debug("Last run was: %s", last_run)
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)
for schedule in old_schedules:
schedule.save()