Exemplo n.º 1
0
 def record_to_entry(self, record, dns_zone):
     return driver.DnsEntry(name=record.name,
                            content=record.data,
                            type=record.type,
                            ttl=record.ttl,
                            priority=record.priority,
                            dns_zone=dns_zone)
Exemplo n.º 2
0
 def create_entry(self, instance_id):
     # Construct hostname using pig-latin.
     hostname = "%s-lay" % instance_id
     LOG.debug("Mapping instance_id %(id)s to hostname %(host)s",
               {'id': instance_id, 'host': hostname})
     return driver.DnsEntry(name=hostname, content=None,
                            type="A", ttl=42, dns_zone=None)
Exemplo n.º 3
0
 def create_entry(self, instance_id):
     # Construct hostname using pig-latin.
     hostname = "%s-lay" % instance_id
     LOG.debug("Mapping instance_id %s to hostname %s" %
               (instance_id, hostname))
     return driver.DnsEntry(name=hostname,
                            content=None,
                            type="A",
                            ttl=42,
                            dns_zone=None)
Exemplo n.º 4
0
    def create_entry(self, instance):
        zone = DesignateDnsZone(id=DNS_DOMAIN_ID, name=DNS_DOMAIN_NAME)
        # Constructing the hostname by hashing the instance ID.
        name = base64.urlsafe_b64encode(hashlib.md5(instance).digest())[:11]
        hostname = ("%s.%s" % (name, zone.name))
        #Removing the leading dot if present
        if hostname.endswith('.'):
            hostname = hostname[:-1]

        return driver.DnsEntry(name=hostname, content=None, type="A",
                               ttl=DNS_TTL, dns_zone=zone)
Exemplo n.º 5
0
    def test_create_entry(self):
        dns_driver = driver.DesignateDriverV2()
        zone = driver.DesignateDnsZone(
            id='22222222-2222-2222-2222-222222222222', name='www.trove.com')
        entry = base_driver.DnsEntry(name='www.example.com', content='None',
                                     type='A', ttl=3600, priority=None,
                                     dns_zone=zone)

        dns_driver.create_entry(entry, '1.2.3.4')
        self.mock_client.recordsets.create.assert_called_once_with(
            driver.DNS_DOMAIN_ID, entry.name + '.', entry.type,
            records=['1.2.3.4'])
Exemplo n.º 6
0
    def create_entry(self, instance_id):
        zone = DesignateDnsZone(id=DNS_DOMAIN_ID, name=DNS_DOMAIN_NAME)
        # Constructing the hostname by hashing the instance ID.
        name = encodeutils.to_utf8(instance_id)
        name = hashlib.md5(name).digest()
        name = base64.b32encode(name)[:11].lower()
        if six.PY3:
            name = name.decode('ascii')
        hostname = ("%s.%s" % (name, zone.name))
        # Removing the leading dot if present
        if hostname.endswith('.'):
            hostname = hostname[:-1]

        return driver.DnsEntry(name=hostname, content=None, type="A",
                               ttl=DNS_TTL, dns_zone=zone)