mirror of
https://github.com/ansible/awx.git
synced 2026-05-20 15:27:47 -02: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:
@@ -5645,13 +5645,12 @@ class InstanceSerializer(BaseSerializer):
|
|||||||
def get_reverse_peers(self, obj):
|
def get_reverse_peers(self, obj):
|
||||||
return Instance.objects.prefetch_related('peers').filter(peers__in=obj.receptor_addresses.all()).values_list('id', flat=True)
|
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):
|
def get_protocol(self, obj):
|
||||||
# note: don't create a different query for receptor addresses, as this is prefetched on the View for optimization
|
# 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():
|
for addr in obj.receptor_addresses.all():
|
||||||
if addr.canonical:
|
if addr.canonical:
|
||||||
return addr.protocol
|
return addr.protocol
|
||||||
return 'tcp'
|
return ""
|
||||||
|
|
||||||
def get_consumed_capacity(self, obj):
|
def get_consumed_capacity(self, obj):
|
||||||
return obj.consumed_capacity
|
return obj.consumed_capacity
|
||||||
|
|||||||
Reference in New Issue
Block a user