def set_hostname(self, hostname): """ Set hostname. @param: str hostname (hostname for system) @returns: True or CX """ self.hostname = validate.hostname(hostname)
def set_hostname(self, hostname: str): """ Set hostname. :param hostname: hostname for system :returns: True or CX """ self.hostname = validate.hostname(hostname)
def dns_name(self, dns_name: str): """ Set DNS name for interface. :param dns_name: DNS Name of the system :raises ValueError: In case the DNS name is already existing inside Cobbler """ dns_name = validate.hostname(dns_name) if dns_name != "" and not self.__api.settings( ).allow_duplicate_hostname: matched = self.__api.find_items("system", {"dns_name": dns_name}) if len(matched) > 0: raise ValueError("DNS name duplicated: %s" % dns_name) self._dns_name = dns_name
def set_dns_name(self, dns_name, interface): """ Set DNS name for interface. @param: str dns_name (dns name) @param: str interface (interface name) @returns: True or CX """ dns_name = validate.hostname(dns_name) if dns_name != "" and utils.input_boolean(self.collection_mgr._settings.allow_duplicate_hostnames) is False: matched = self.collection_mgr.api.find_items("system", {"dns_name": dns_name}) for x in matched: if x.name != self.name: raise CX("DNS name duplicated: %s" % dns_name) intf = self.__get_interface(interface) intf["dns_name"] = dns_name
def set_dns_name(self, dns_name: str, interface: str): """ Set DNS name for interface. :param dns_name: DNS name :param interface: interface name :returns: True or CX """ dns_name = validate.hostname(dns_name) if dns_name != "" and self.collection_mgr.settings( ).allow_duplicate_hostnames is False: matched = self.collection_mgr.api.find_items( "system", {"dns_name": dns_name}) for x in matched: if x.name != self.name: raise CX("DNS name duplicated: %s" % dns_name) intf = self.__get_interface(interface) intf["dns_name"] = dns_name