Merge pull request #13069 from jbradberry/hostname-validation-regression

Add back in the uniqueness validation on Instance.hostname
This commit is contained in:
Jeff Bradberry 2022-10-17 11:40:54 -04:00 committed by GitHub
commit eeb9d61488
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -4931,7 +4931,8 @@ class InstanceSerializer(BaseSerializer):
'node_state': {'initial': Instance.States.INSTALLED, 'default': Instance.States.INSTALLED},
'hostname': {
'validators': [
MaxLengthValidator(limit_value=255),
MaxLengthValidator(limit_value=250),
validators.UniqueValidator(queryset=Instance.objects.all()),
RegexValidator(
regex='^localhost$|^127(?:\.[0-9]+){0,2}\.[0-9]+$|^(?:0*\:)*?:?0*1$',
flags=re.IGNORECASE,