From b879cbc2ece36bedfbef9987dc729c392a3a0682 Mon Sep 17 00:00:00 2001 From: Jeff Bradberry Date: Tue, 20 Sep 2022 09:38:38 -0400 Subject: [PATCH] Prevent any edits to hop nodes to retain the behavior that they had pre-mesh-scaling. --- awx/api/serializers.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/awx/api/serializers.py b/awx/api/serializers.py index a41b8cb47e..a028c3a90b 100644 --- a/awx/api/serializers.py +++ b/awx/api/serializers.py @@ -4946,8 +4946,12 @@ class InstanceSerializer(BaseSerializer): return float("{0:.2f}".format(((float(obj.capacity) - float(obj.consumed_capacity)) / (float(obj.capacity))) * 100)) def validate(self, data): - if not self.instance and not settings.IS_K8S: - raise serializers.ValidationError("Can only create instances on Kubernetes or OpenShift.") + if self.instance: + if self.instance.node_type == Instance.Types.HOP: + raise serializers.ValidationError("Hop node instances may not be changed.") + else: + if not settings.IS_K8S: + raise serializers.ValidationError("Can only create instances on Kubernetes or OpenShift.") return data def validate_node_type(self, value):