From 73d2c92ae392414b35b814b7d3f8ab1ba76f77cc Mon Sep 17 00:00:00 2001 From: Hao Liu Date: Wed, 17 Jan 2024 16:55:27 -0500 Subject: [PATCH] Fix condition for creating receptor_address If listener_port is not explicitly defined don't create a receptor_address --- awx/api/serializers.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/awx/api/serializers.py b/awx/api/serializers.py index 5af82c063f..0d4dacc77f 100644 --- a/awx/api/serializers.py +++ b/awx/api/serializers.py @@ -5609,10 +5609,10 @@ class InstanceSerializer(BaseSerializer): else: instance = super(InstanceSerializer, self).update(obj, validated_data) - if 'port' in kwargs and kwargs['port'] is None: - # delete the receptor address if the port is None + if 'port' in kwargs and not kwargs['port']: + # delete the receptor address if the port is expolisitly set to None instance.receptor_addresses.filter(address=instance.hostname).delete() - elif kwargs: + elif 'port' in kwargs: kwargs['canonical'] = True instance.receptor_addresses.update_or_create(address=instance.hostname, defaults=kwargs)