|
|
@@ -349,14 +349,10 @@ class VirtualMachine(NetBoxModel, ConfigContextModel):
|
|
|
# Validate site for cluster & device
|
|
|
if self.cluster and self.site and self.cluster.site != self.site:
|
|
|
raise ValidationError({
|
|
|
- 'cluster': f'The selected cluster ({self.cluster} is not assigned to this site ({self.site}).'
|
|
|
+ 'cluster': f'The selected cluster ({self.cluster}) is not assigned to this site ({self.site}).'
|
|
|
})
|
|
|
elif self.cluster:
|
|
|
self.site = self.cluster.site
|
|
|
- if self.device and self.device.site != self.site:
|
|
|
- raise ValidationError({
|
|
|
- 'device': f'The selected device ({self.device} is not assigned to this site ({self.site}).'
|
|
|
- })
|
|
|
|
|
|
# Validate assigned cluster device
|
|
|
if self.device and not self.cluster:
|
|
|
@@ -365,7 +361,7 @@ class VirtualMachine(NetBoxModel, ConfigContextModel):
|
|
|
})
|
|
|
if self.device and self.device not in self.cluster.devices.all():
|
|
|
raise ValidationError({
|
|
|
- 'device': f'The selected device ({self.device} is not assigned to this cluster ({self.cluster}).'
|
|
|
+ 'device': f'The selected device ({self.device}) is not assigned to this cluster ({self.cluster}).'
|
|
|
})
|
|
|
|
|
|
# Validate primary IP addresses
|