mirror of
https://github.com/ansible/awx.git
synced 2026-01-10 15:32:07 -03:30
Protocol blank if no canonical address
Make protocol be blank on instance if there is no canonical address for this instance. It was defaulting to "tcp" before. Signed-off-by: Seth Foster <fosterbseth@gmail.com>
This commit is contained in:
parent
083c05f12a
commit
48971411cc
@ -5645,13 +5645,12 @@ class InstanceSerializer(BaseSerializer):
|
||||
def get_reverse_peers(self, obj):
|
||||
return Instance.objects.prefetch_related('peers').filter(peers__in=obj.receptor_addresses.all()).values_list('id', flat=True)
|
||||
|
||||
# FIXME: protocol should be blank, null, or missing if there is no canonical address
|
||||
def get_protocol(self, obj):
|
||||
# note: don't create a different query for receptor addresses, as this is prefetched on the View for optimization
|
||||
for addr in obj.receptor_addresses.all():
|
||||
if addr.canonical:
|
||||
return addr.protocol
|
||||
return 'tcp'
|
||||
return ""
|
||||
|
||||
def get_consumed_capacity(self, obj):
|
||||
return obj.consumed_capacity
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user