Use a select_related to build the peers queryset in the install bundle

Since the relationship is ReceptorAddress -> Instance,
prefetch_related isn't necessary.
This commit is contained in:
Jeff Bradberry 2024-01-25 10:31:14 -05:00 committed by Seth Foster
parent 05502c0af8
commit 8f22188116

View File

@ -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)