Skip to content

Commit

Permalink
Prevent any edits to hop nodes
Browse files Browse the repository at this point in the history
to retain the behavior that they had pre-mesh-scaling.
  • Loading branch information
jbradberry committed Sep 23, 2022
1 parent af8b524 commit b879cbc
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions awx/api/serializers.py
Original file line number Diff line number Diff line change
Expand Up @@ -4946,8 +4946,12 @@ def get_percent_capacity_remaining(self, obj):
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):
Expand Down

0 comments on commit b879cbc

Please sign in to comment.