Example #1
0
    def _aa_domain_name(self):
        """
        option domain-name text;

            The 'text' should be a space seperated domain names. I.E.:
            phx.mozilla.com phx1.mozilla.com This option specifies the domain
            name that client should use when resolving hostnames via the Domain
            Name System.
        """
        self.is_option = True
        self.is_statement = False
        self.has_validator = True
        self.is_quoted = True
        val = self._get_value()
        if not is_valid_domain(val):
            raise ValidationError("{0} is not a valid "
                                  "domain-name option".format(val))
Example #2
0
    def _aa_hostname(self):
        """
        The host-name option

            option host-name string;

            This option specifies the name of the client. The name may or may
            not be qualified with the local domain name (it is preferable to
            use the domain-name option to specify the domain name). See RFC
            1035 for character set restrictions. This option is only honored by
            dhclient-script(8) if the hostname for the client machine is not
            set.
        """
        self.is_option = True
        self.is_statement = False
        self.has_validator = True
        val = self._get_value()
        if not is_valid_domain(val):
            raise ValidationError("{0} is not a valid host name".format(val))
Example #3
0
    def _aa_next_server(self):
        """
        The next-server statement

            next-server server-name;

             The next-server statement is used to specify the host address of
             the server from which the initial boot file (specified in the
             filename statement) is to be loaded.  Server-name should be a
             numeric IP address or a domain name.  If no next-server parameter
             applies to a given client, the DHCP server's IP address is used.
        """
        self.is_option = False
        self.is_statement = True
        self.has_validator = True
        val = self._get_value()
        if not (is_valid_ip(val) or is_valid_domain(val)):
            raise ValidationError("{0} is not a valid next-server statement "
                                  "and should be an ip or domain".format(val))