def create_domain(self, fqdomain): if self.get_entries_by_name(fqdomain, ''): raise exception.FloatingIpDNSExists(name=fqdomain, domain='') outfile = open(self.filename, 'a+') outfile.write("%s %s %s\n" % ('domain', fqdomain, 'domain')) outfile.close()
def add_entry(self, name, address): if self.subentry_with_name(name): raise exception.FloatingIpDNSExists(name=name, domain=self.qualified_domain) entries = self.subentries_with_ip(address) if entries: # We already have an ldap entry for this IP, so we just # need to add the new name. existingdn = entries[0].dn self.lobj.modify_s(existingdn, [(ldap.MOD_ADD, 'associatedDomain', utils.utf8(self._qualify(name)))]) return self.subentry_with_name(name) else: # We need to create an entirely new entry. newdn = "dc=%s,%s" % (name, self.dn) attrs = { 'objectClass': [ 'domainrelatedobject', 'dnsdomain', 'domain', 'dcobject', 'top' ], 'aRecord': [address], 'associatedDomain': [self._qualify(name)], 'dc': [name] } self.lobj.add_s(newdn, create_modlist(attrs)) return self.subentry_with_name(name) self.update_soa()
def create_domain(self, fqdomain): if self.get_entries_by_name(fqdomain, ''): raise exception.FloatingIpDNSExists(name=fqdomain, domain='') self.file.seek(0, os.SEEK_END) self.file.write("%s %s %s\n" % ('domain', fqdomain, 'domain')) self.file.flush()
def create_entry(self, name, address, type, dnszone): if self.get_entries_by_name(name, dnszone): raise exception.FloatingIpDNSExists(name=name, zone=dnszone) outfile = open(self.filename, 'a+') outfile.write("%s %s %s\n" % (address, self.qualify(name, dnszone), type)) outfile.close()
def create_entry(self, name, address, type, domain): if type.lower() != 'a': raise exception.InvalidInput(_("This driver only supports " "type 'a'")) if self.get_entries_by_name(name, domain): raise exception.FloatingIpDNSExists(name=name, domain=domain) outfile = open(self.filename, 'a+') outfile.write("%s %s %s\n" % (address, self.qualify(name, domain), type)) outfile.close()
def create_domain(cls, lobj, domain): """Create a new domain entry, and return an object that wraps it.""" entry = cls._get_tuple_for_domain(lobj, domain) if entry: raise exception.FloatingIpDNSExists(name=domain, domain='') newdn = 'dc=%s,%s' % (domain, CONF.ldap_dns_base_dn) attrs = {'objectClass': ['domainrelatedobject', 'dnsdomain', 'domain', 'dcobject', 'top'], 'sOARecord': [cls._soa()], 'associatedDomain': [domain], 'dc': [domain]} lobj.add_s(newdn, create_modlist(attrs)) return DomainEntry(lobj, domain)
def create_entry(self, name, address, type, domain): if name is None: raise exception.InvalidInput(_("Invalid name")) if type.lower() != 'a': raise exception.InvalidInput( _("This driver only supports " "type 'a'")) if self.get_entries_by_name(name, domain): raise exception.FloatingIpDNSExists(name=name, domain=domain) self.file.seek(0, os.SEEK_END) self.file.write("%s %s %s\n" % (address, self.qualify(name, domain), type)) self.file.flush()