From b727d2c3b33821cc044f9d33b57e641e3837baf9 Mon Sep 17 00:00:00 2001 From: Alan Rominger Date: Tue, 9 Jul 2024 15:13:08 -0400 Subject: [PATCH] Log conflicts and created items by the periodic resource sync (#15337) * Initial lazy logging of periodic sync results * Add desired polish to log * Add debug log --- awx/main/tasks/system.py | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/awx/main/tasks/system.py b/awx/main/tasks/system.py index c0f71bbc7f..719164bc0a 100644 --- a/awx/main/tasks/system.py +++ b/awx/main/tasks/system.py @@ -980,5 +980,15 @@ def periodic_resource_sync(): if acquired is False: logger.debug("Not running periodic_resource_sync, another task holds lock") return + logger.debug("Running periodic resource sync") - SyncExecutor().run() + executor = SyncExecutor() + executor.run() + for key, item_list in executor.results: + if not item_list or key == 'noop': + continue + # Log creations and conflicts + if len(item_list) > 10 and settings.LOG_AGGREGATOR_LEVEL != 'DEBUG': + logger.info(f'Periodic resource sync {key}, first 10 items:\n{item_list[:10]}') + else: + logger.info(f'Periodic resource sync {key}:\n{item_list}')