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)
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)
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)
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)
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'])
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)