mirror of
https://github.com/ansible/awx.git
synced 2026-03-04 02:01:01 -03:30
Add validation when setting peers
- cannot peer to self - cannot peer to instance that is already peered to self Other changes: - ReceptorAddress protocol field restricted to choices: tcp, ws, wss - fix awx-manage list_instances when instance.last_seen is None - InstanceLink make source and target unique together - Add help text to the ReceptorAddress fields Signed-off-by: Seth Foster <fosterbseth@gmail.com>
This commit is contained in:
@@ -6,6 +6,7 @@ import logging
|
||||
import os
|
||||
|
||||
from django.core.validators import MinValueValidator, MaxValueValidator
|
||||
from django.core.exceptions import ValidationError
|
||||
from django.db import models, connection
|
||||
from django.db.models.signals import post_save, post_delete
|
||||
from django.dispatch import receiver
|
||||
@@ -67,6 +68,7 @@ class HasPolicyEditsMixin(HasEditsMixin):
|
||||
class InstanceLink(BaseModel):
|
||||
class Meta:
|
||||
ordering = ("id",)
|
||||
constraints = [models.UniqueConstraint(fields=['source', 'target'], name='source_target_unique_together')]
|
||||
|
||||
source = models.ForeignKey('Instance', on_delete=models.CASCADE)
|
||||
target = models.ForeignKey('ReceptorAddress', on_delete=models.CASCADE)
|
||||
|
||||
Reference in New Issue
Block a user