summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHao Liu <haoli@redhat.com>2024-01-17 22:55:27 +0100
committerSeth Foster <fosterseth@users.noreply.github.com>2024-02-02 16:37:41 +0100
commit73d2c92ae392414b35b814b7d3f8ab1ba76f77cc (patch)
treed84d4879ce6e77bca070e62c679444da2abd9a6d
parentAdd protocol to receptor address serializer (diff)
downloadawx-73d2c92ae392414b35b814b7d3f8ab1ba76f77cc.tar.xz
awx-73d2c92ae392414b35b814b7d3f8ab1ba76f77cc.zip
Fix condition for creating receptor_address
If listener_port is not explicitly defined don't create a receptor_address
-rw-r--r--awx/api/serializers.py6
1 files 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)