Пример #1
0
def is_new_bind(port, ip=None):
    if ip:
        ip = validations.is_ip(ip)
        port = validations.is_tcp_port(port)
    else:
        port = validations.is_new_tcp_port(port)

    binds = [(CTK.cfg.get_val('server!bind!%s!port' % (x)),
              CTK.cfg.get_val('server!bind!%s!interface' % (x)))
             for x in CTK.cfg.keys('server!bind')]

    if (port, ip) in binds:
        raise ValueError, _("Port/Interface combination already in use.")
Пример #2
0
def is_new_bind (port, ip=None):
    if ip:
        ip   = validations.is_ip (ip)
        port = validations.is_tcp_port (port)
    else:
        port = validations.is_new_tcp_port (port)

    binds = [(CTK.cfg.get_val('server!bind!%s!port'%(x)),
              CTK.cfg.get_val('server!bind!%s!interface'%(x)))
             for x in CTK.cfg.keys ('server!bind')]

    if (port, ip) in binds:
        raise ValueError, _("Port/Interface combination already in use.")
Пример #3
0
    def clean(self):
        if not valids.is_ip(self.net_ip_address):
            raise ValidationError("Given IP is invalid - {0}".format(self.net_ip_address))

        if not valids.in_subnet(self.net_ip_address, self.network.net_cidr):
            raise ValidationError(
                "Given IP is not in network CIDR - {0} {1}".format(self.net_ip_address, self.network.net_cidr)
            )
        if len(self.name) < 8:
            raise ValidationError("Name to short, must be at least 8 characters")

        if self.ram <= 0 or self.hd_space <= 0 or self.cores <= 0 or self.cycle_rate <= 0 or self.bandwidth <= 0:
            raise ValidationError("All server stats must be larger than 0")

        # Validate:
        # - No other server on the network has the same ip.
        pass
Пример #4
0
    def clean(self):
        if not valids.is_cidr(self.net_cidr):
            raise ValidationError("Given net CIDR invalid - {0}".format(self.net_cidr))

        if not valids.is_ip(self.external_ip):
            raise ValidationError("Given IP is invalid - {0}".format(self.external_ip))