From b7b90e50531bcbd2caaffe6b51aea8917a56f40d Mon Sep 17 00:00:00 2001 From: JINMEI Tatuya Date: Tue, 6 Dec 2011 15:25:52 -0800 Subject: [PATCH] [1369] omit optional parameters of ZoneFinder.find() --- src/bin/xfrin/tests/xfrin_test.py | 7 +++---- src/bin/xfrout/tests/xfrout_test.py.in | 2 +- src/lib/python/isc/notify/notify_out.py | 15 +++++---------- 3 files changed, 9 insertions(+), 15 deletions(-) diff --git a/src/bin/xfrin/tests/xfrin_test.py b/src/bin/xfrin/tests/xfrin_test.py index 00e42beecd..25bce6fa17 100644 --- a/src/bin/xfrin/tests/xfrin_test.py +++ b/src/bin/xfrin/tests/xfrin_test.py @@ -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): diff --git a/src/bin/xfrout/tests/xfrout_test.py.in b/src/bin/xfrout/tests/xfrout_test.py.in index 8373e15d1e..ea4de27a18 100644 --- a/src/bin/xfrout/tests/xfrout_test.py.in +++ b/src/bin/xfrout/tests/xfrout_test.py.in @@ -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. diff --git a/src/lib/python/isc/notify/notify_out.py b/src/lib/python/isc/notify/notify_out.py index af79b7c185..64a4b3e94e 100644 --- a/src/lib/python/isc/notify/notify_out.py +++ b/src/lib/python/isc/notify/notify_out.py @@ -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 ' +