Merge "Validate MX records during recordset create or update"
This commit is contained in:
commit
71c7542a89
|
@ -35,6 +35,9 @@ class MX(Record):
|
|||
if repr(int(priority)) != priority:
|
||||
raise ValueError('Value is not an integer')
|
||||
|
||||
if not exchange.endswith('.'):
|
||||
raise ValueError('Domain %s does not end with a dot' % exchange)
|
||||
|
||||
self.priority = int(priority)
|
||||
self.exchange = exchange
|
||||
|
||||
|
|
|
@ -34,7 +34,18 @@ class RRDataMXTest(oslotest.base.BaseTestCase):
|
|||
record_set = objects.RecordSet(
|
||||
name='www.example.org.', type='MX',
|
||||
records=objects.RecordList(objects=[
|
||||
objects.Record(data='-0 mail.example.org.',
|
||||
objects.Record(data='-0 mail.example.test.',
|
||||
status='ACTIVE'),
|
||||
])
|
||||
)
|
||||
|
||||
self.assertRaises(InvalidObject, record_set.validate)
|
||||
|
||||
def test_validate_mx_not_fqdn(self):
|
||||
record_set = objects.RecordSet(
|
||||
name='www.example.org.', type='MX',
|
||||
records=objects.RecordList(objects=[
|
||||
objects.Record(data='10 mail.example.test',
|
||||
status='ACTIVE'),
|
||||
])
|
||||
)
|
||||
|
|
Loading…
Reference in New Issue