mirror of
https://github.com/ansible/awx.git
synced 2026-03-13 23:17:32 -02:30
Check for inventory sources already updated from start args
In the case where the host didn't exist in the inventory source and was found in the first inventory sync
This commit is contained in:
@@ -5,6 +5,7 @@
|
||||
from datetime import datetime, timedelta
|
||||
import logging
|
||||
import uuid
|
||||
import json
|
||||
from sets import Set
|
||||
|
||||
# Django
|
||||
@@ -37,6 +38,7 @@ from awx.main.signals import disable_activity_stream
|
||||
|
||||
from awx.main.scheduler.dependency_graph import DependencyGraph
|
||||
from awx.main import tasks as awx_tasks
|
||||
from awx.main.utils import decrypt_field
|
||||
|
||||
# Celery
|
||||
from celery.task.control import inspect
|
||||
@@ -379,6 +381,7 @@ class TaskManager():
|
||||
def generate_dependencies(self, task):
|
||||
dependencies = []
|
||||
if type(task) is Job:
|
||||
start_args = json.loads(decrypt_field(task, field_name="start_args"))
|
||||
# TODO: Can remove task.project None check after scan-job-default-playbook is removed
|
||||
if task.project is not None and task.project.scm_update_on_launch is True:
|
||||
latest_project_update = self.get_latest_project_update(task)
|
||||
@@ -391,6 +394,8 @@ class TaskManager():
|
||||
|
||||
# Inventory created 2 seconds behind job
|
||||
for inventory_source in [invsrc for invsrc in self.all_inventory_sources if invsrc.inventory == task.inventory]:
|
||||
if "inventory_sources_already_updated" in start_args and inventory_source.id in start_args['inventory_sources_already_updated']:
|
||||
continue
|
||||
if not inventory_source.update_on_launch:
|
||||
continue
|
||||
latest_inventory_update = self.get_latest_inventory_update(inventory_source)
|
||||
|
||||
Reference in New Issue
Block a user