mirror of
https://github.com/ansible/awx.git
synced 2026-01-10 15:32:07 -03:30
The listener port cannot be disabled when setting peers_from_control_nodes
If the port is explicitly set to null (causing any ReceptorAddress to be deleted), then that's a validation error. If the port is left off but a ReceptorAddress doesn't already exist, we should not infer a port number and that is also a validation error.
This commit is contained in:
parent
1b44bebed3
commit
1e254c804c
@ -5710,7 +5710,8 @@ class InstanceSerializer(BaseSerializer):
|
||||
|
||||
# cannot enable peers_from_control_nodes if listener_port is not set
|
||||
if attrs.get('peers_from_control_nodes'):
|
||||
if not attrs.get('listener_port') and self.instance and self.instance.canonical_address_port is None:
|
||||
port = attrs.get('listener_port', -1) # -1 denotes missing, None denotes explicit null
|
||||
if (port is None) or (port == -1 and self.instance and self.instance.canonical_address is None):
|
||||
raise serializers.ValidationError(_("Cannot enable peers_from_control_nodes if listener_port is not set."))
|
||||
|
||||
return super().validate(attrs)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user