Exemple #1
0
    def clean(self, *args, **kwargs):
        validate_glue = kwargs.pop('validate_glue', True)

        super(StaticInterface, self).clean(validate_glue=False,
                                           ignore_intr=True)

        if self.dhcp_enabled or self.dns_enabled:
            if not self.range:
                raise ValidationError("An appropriate static range can not be "
                                      "found for this IP address.")
            if self.ctnr not in self.range.ctnr_set.all():
                raise ValidationError("Can't create interface because %s is "
                                      "not in its container." % self.ip_str)

        from cyder.cydns.ptr.models import PTR
        if PTR.objects.filter(ip_str=self.ip_str, fqdn=self.fqdn).exists():
            raise ValidationError("A PTR already uses '%s' and '%s'" %
                                  (self.fqdn, self.ip_str))
        if AddressRecord.objects.filter(ip_str=self.ip_str, fqdn=self.fqdn
                                        ).exists():
            raise ValidationError("An A record already uses '%s' and '%s'" %
                                  (self.fqdn, self.ip_str))

        if validate_glue:
            self.check_glue_status()

        if self.dhcp_enabled:
            if not (self.range and self.range.range_type == STATIC):
                raise ValidationError('DHCP is enabled for this interface, so '
                                      'its IP must be in a static range.')

        validate_system_static_ctnr(self.system, self)
Exemple #2
0
    def clean(self, *args, **kwargs):
        validate_glue = kwargs.pop('validate_glue', True)

        super(StaticInterface, self).clean(validate_glue=False,
                                           ignore_intr=True)

        if self.dhcp_enabled or self.dns_enabled:
            if not self.range:
                raise ValidationError("An appropriate static range can not be "
                                      "found for this IP address.")
            if self.ctnr not in self.range.ctnr_set.all():
                raise ValidationError("Can't create interface because %s is "
                                      "not in its container." % self.ip_str)

        self.check_A_PTR_collision()

        if (self.workgroup.pk != DEFAULT_WORKGROUP
                and self.ctnr not in self.workgroup.ctnr_set.all()):
            raise ValidationError("Workgroup is not in this static "
                                  "interface's container.")

        if validate_glue:
            self.check_glue_status()

        if self.dhcp_enabled:
            if not (self.range and self.range.range_type == STATIC):
                raise ValidationError('DHCP is enabled for this interface, so '
                                      'its IP must be in a static range.')

        validate_system_static_ctnr(self.system, self)
Exemple #3
0
 def clean(self, *args, **kwargs):
     super(System, self).clean(*args, **kwargs)
     for si in self.staticinterface_set.all():
         validate_system_static_ctnr(self, si)
     for di in self.dynamicinterface_set.all():
         validate_system_dynamic_ctnr(self, di)