Commit b7b90e50 authored by JINMEI Tatuya's avatar JINMEI Tatuya
Browse files

[1369] omit optional parameters of ZoneFinder.find()

parent fd5713ea
......@@ -159,7 +159,7 @@ class MockDataSourceClient():
return (DataSourceClient.PARTIALMATCH, self)
raise ValueError('Unexpected input to mock client: bug in test case?')
def find(self, name, rrtype, target, options):
def find(self, name, rrtype, target=None, options=ZoneFinder.FIND_DEFAULT):
'''Mock ZoneFinder.find().
It returns the predefined SOA RRset to queries for SOA of the common
......@@ -1528,8 +1528,7 @@ class TestXFRSessionWithSQLite3(TestXfrinConnection):
def get_zone_serial(self):
result, finder = self.conn._datasrc_client.find_zone(TEST_ZONE_NAME)
self.assertEqual(DataSourceClient.SUCCESS, result)
result, soa = finder.find(TEST_ZONE_NAME, RRType.SOA(),
None, ZoneFinder.FIND_DEFAULT)
result, soa = finder.find(TEST_ZONE_NAME, RRType.SOA())
self.assertEqual(ZoneFinder.SUCCESS, result)
self.assertEqual(1, soa.get_rdata_count())
return get_soa_serial(soa.get_rdata()[0])
......@@ -1537,7 +1536,7 @@ class TestXFRSessionWithSQLite3(TestXfrinConnection):
def record_exist(self, name, type):
result, finder = self.conn._datasrc_client.find_zone(TEST_ZONE_NAME)
self.assertEqual(DataSourceClient.SUCCESS, result)
result, soa = finder.find(name, type, None, ZoneFinder.FIND_DEFAULT)
result, soa = finder.find(name, type)
return result == ZoneFinder.SUCCESS
def test_do_ixfrin_sqlite3(self):
......
......@@ -95,7 +95,7 @@ class MockDataSrcClient:
return (isc.datasrc.DataSourceClient.NOTFOUND, None)
return (isc.datasrc.DataSourceClient.SUCCESS, self)
def find(self, name, rrtype, target, options):
def find(self, name, rrtype, target=None, options=ZoneFinder.FIND_DEFAULT):
'''Mock ZoneFinder.find().
(At the moment) this method only handles query for type SOA.
......
......@@ -284,14 +284,12 @@ class NotifyOut:
format_zone_str(zone_name, zone_class))
return []
result, ns_rrset = finder.find(zone_name, RRType.NS(), None,
finder.FIND_DEFAULT)
result, ns_rrset = finder.find(zone_name, RRType.NS())
if result is not finder.SUCCESS or ns_rrset is None:
logger.warn(NOTIFY_OUT_ZONE_NO_NS,
format_zone_str(zone_name, zone_class))
return []
result, soa_rrset = finder.find(zone_name, RRType.SOA(), None,
finder.FIND_DEFAULT)
result, soa_rrset = finder.find(zone_name, RRType.SOA())
if result is not finder.SUCCESS or soa_rrset is None or \
soa_rrset.get_rdata_count() != 1:
logger.warn(NOTIFY_OUT_ZONE_BAD_SOA,
......@@ -304,13 +302,11 @@ class NotifyOut:
ns_name = Name(ns_rdata.to_text())
if soa_mname == ns_name:
continue
result, rrset = finder.find(ns_name, RRType.A(), None,
finder.FIND_DEFAULT)
result, rrset = finder.find(ns_name, RRType.A())
if result is finder.SUCCESS and rrset is not None:
addrs.extend([a.to_text() for a in rrset.get_rdata()])
result, rrset = finder.find(ns_name, RRType.AAAA(), None,
finder.FIND_DEFAULT)
result, rrset = finder.find(ns_name, RRType.AAAA())
if result is finder.SUCCESS and rrset is not None:
addrs.extend([aaaa.to_text() for aaaa in rrset.get_rdata()])
......@@ -504,8 +500,7 @@ class NotifyOut:
zone_name.to_text() + '/' +
zone_class.to_text() + ' not found')
result, soa_rrset = finder.find(zone_name, RRType.SOA(), None,
finder.FIND_DEFAULT)
result, soa_rrset = finder.find(zone_name, RRType.SOA())
if result is not finder.SUCCESS or soa_rrset is None or \
soa_rrset.get_rdata_count() != 1:
raise NotifyOutDataSourceError('_get_zone_soa: Zone ' +
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment