mirror of
https://github.com/ansible/awx.git
synced 2026-03-11 14:39:30 -02:30
Add validation for hop nodes
Add validation for hop nodes See: https://github.com/ansible/awx/issues/11622
This commit is contained in:
@@ -4850,6 +4850,11 @@ class InstanceSerializer(BaseSerializer):
|
|||||||
else:
|
else:
|
||||||
return float("{0:.2f}".format(((float(obj.capacity) - float(obj.consumed_capacity)) / (float(obj.capacity))) * 100))
|
return float("{0:.2f}".format(((float(obj.capacity) - float(obj.consumed_capacity)) / (float(obj.capacity))) * 100))
|
||||||
|
|
||||||
|
def validate(self, attrs):
|
||||||
|
if self.instance.node_type == 'hop':
|
||||||
|
raise serializers.ValidationError(_('Hop node instances may not be changed.'))
|
||||||
|
return attrs
|
||||||
|
|
||||||
|
|
||||||
class InstanceHealthCheckSerializer(BaseSerializer):
|
class InstanceHealthCheckSerializer(BaseSerializer):
|
||||||
class Meta:
|
class Meta:
|
||||||
|
|||||||
Reference in New Issue
Block a user