Skip to content

Commit

Permalink
Added support for wildcard dns (#249)
Browse files Browse the repository at this point in the history
  • Loading branch information
nuwang committed Oct 20, 2020
1 parent 24a13a0 commit 3460765
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
2 changes: 1 addition & 1 deletion cloudbridge/base/resources.py
Original file line number Diff line number Diff line change
Expand Up @@ -934,7 +934,7 @@ def delete(self):
class BaseDnsRecord(BaseCloudResource, DnsRecord):

CB_NAME_PATTERN = re.compile(
r"^(?:[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?\.)+[a-z0-9]"
r"^(?:\*\.)?(?:[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?\.)+[a-z0-9]"
r"[a-z0-9-]{0,61}[a-z0-9]\.?$")

def __init__(self, provider):
Expand Down
14 changes: 14 additions & 0 deletions tests/test_dns_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,20 @@ def cleanup_dns_rec(dns_rec):
"cb-dnsrec", create_dns_rec,
cleanup_dns_rec, skip_name_check=True)

@helpers.skipIfNoService(['dns.host_zones'])
def test_create_wildcard_dns_record(self):
test_zone = None
zone_name = "cb-dnswild-{0}.com.".format(helpers.get_uuid())

with cb_helpers.cleanup_action(lambda: test_zone.delete()):
test_zone = self.provider.dns.host_zones.create(
zone_name, "admin@cloudve.org")
test_rec = None
with cb_helpers.cleanup_action(lambda: test_rec.delete()):
test_rec = test_zone.records.create(
"*.cb-wildcard." + zone_name, DnsRecordType.A,
data='10.1.1.1')

@helpers.skipIfNoService(['dns.host_zones'])
def test_dns_record_properties(self):
test_zone = None
Expand Down

0 comments on commit 3460765

Please sign in to comment.