Skip to content

Commit 88a5b21

Browse files
alexderzsudorandom
authored andcommitted
Enable zone import to import wildcard entries (softlayer#769)
Enable zone import to import wildcard entries
1 parent 8f88231 commit 88a5b21

2 files changed

Lines changed: 12 additions & 2 deletions

File tree

SoftLayer/CLI/dns/zone_import.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
from SoftLayer.CLI import exceptions
1010
from SoftLayer.CLI import helpers
1111

12-
RECORD_REGEX = re.compile(r"""^((?P<domain>([\w-]+(\.)?)*|\@)?\s+
12+
RECORD_REGEX = re.compile(r"""^((?P<domain>(([\w-]+|\*)(\.)?)*|\@)?\s+
1313
(?P<ttl>\d+)?\s+
1414
(?P<class>\w+)?)?\s+
1515
(?P<type>\w+)\s+

tests/CLI/modules/dns_tests.py

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,8 @@ def test_parse_zone_file(self):
115115
dev.realtest.com IN TXT "This is just a test of the txt record"
116116
IN AAAA 2001:db8:10::1
117117
spf IN TXT "v=spf1 ip4:192.0.2.0/24 ip4:198.51.100.123 a"
118+
*.testing 86400 IN A 127.0.0.2
119+
* 86400 IN A 127.0.0.3
118120
119121
"""
120122
expected = [{'data': 'ns1.softlayer.com.',
@@ -148,7 +150,15 @@ def test_parse_zone_file(self):
148150
{'data': '"v=spf1 ip4:192.0.2.0/24 ip4:198.51.100.123 a"',
149151
'record': 'spf',
150152
'type': 'TXT',
151-
'ttl': None}]
153+
'ttl': None},
154+
{'data': '127.0.0.2',
155+
'record': '*.testing',
156+
'type': 'A',
157+
'ttl': '86400'},
158+
{'data': '127.0.0.3',
159+
'record': '*',
160+
'type': 'A',
161+
'ttl': '86400'}]
152162
zone, records, bad_lines = zone_import.parse_zone_details(zone_file)
153163
self.assertEqual(zone, 'realtest.com')
154164
self.assertEqual(records, expected)

0 commit comments

Comments
 (0)