diff --git a/awx/main/tasks.py b/awx/main/tasks.py index 76124276b2..83af9cb9b4 100644 --- a/awx/main/tasks.py +++ b/awx/main/tasks.py @@ -195,7 +195,14 @@ def cluster_node_heartbeat(self): other_inst.version, inst.hostname, inst.version)) + # Set the capacity to zero to ensure no Jobs get added to this instance. + # The heartbeat task will reset the capacity to the system capacity after upgrade. + inst.capacity = 0 + inst.save() stop_local_services(['uwsgi', 'celery', 'beat', 'callback', 'fact']) + # We wait for the Popen call inside stop_local_services above + # so the line below will rarely if ever be executed. + raise RuntimeError("Shutting down.") @task(bind=True)