From 8f22188116b24f5094f3e8ffd33de02727ea03a9 Mon Sep 17 00:00:00 2001 From: Jeff Bradberry Date: Thu, 25 Jan 2024 10:31:14 -0500 Subject: [PATCH] Use a select_related to build the peers queryset in the install bundle Since the relationship is ReceptorAddress -> Instance, prefetch_related isn't necessary. --- awx/api/views/instance_install_bundle.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/awx/api/views/instance_install_bundle.py b/awx/api/views/instance_install_bundle.py index eefb9d0b6a..6e4d802ed0 100644 --- a/awx/api/views/instance_install_bundle.py +++ b/awx/api/views/instance_install_bundle.py @@ -126,7 +126,7 @@ def generate_inventory_yml(instance_obj): def generate_group_vars_all_yml(instance_obj): # get peers peers = [] - for addr in instance_obj.peers.all().prefetch_related('instance'): + for addr in instance_obj.peers.select_related('instance'): peers.append(dict(address=addr.get_full_address(), protocol=addr.protocol)) context = dict(instance=instance_obj, peers=peers)