Commit 525021e0 authored by JINMEI Tatuya's avatar JINMEI Tatuya
Browse files

[2964] make sure to catch exception from DataSrcClientsMgr.reconfigure.

parent e51d6fd3
......@@ -251,9 +251,19 @@ class MockDataSrcClientsMgr():
# Default faked result of find(), customizable by tests
self.found_datasrc_client = MockDataSourceClient()
self.reconfigure_param = [] # for inspection
def get_client_list(self, rrclass):
return self.found_datasrc_client_list
def reconfigure(self, arg1):
# the only current test simply needs to know this is called with
# the expected argument and exceptions are handled. if we need more
# variations in tests, this mock method should be extended.
raise isc.server_common.datasrc_clients_mgr.ConfigError(
'reconfigure failure')
def find(self, zone_name, want_exact_match, want_finder):
"""Pretending find method on the object returned by get_clinet_list"""
if issubclass(type(self.found_datasrc_client), Exception):
......@@ -3037,6 +3047,15 @@ class TestXfrin(unittest.TestCase):
def test_datasrc_config_handler(self):
"""Check datasrc config handler works expectedly."""
# This is a simple wrapper of DataSrcClientsMgr.reconfigure(), so
# we just check it's called as expected, and the only possible
# exception doesn't cause disruption.
self.xfr._datasrc_config_handler(True, False)
def raise_interrupt():
raise KeyboardInterrupt()
......@@ -1391,6 +1391,9 @@ class Xfrin:
config_data = self._module_cc.get_full_config()
# data_sources configuration should be ready with cfgmgr, so this
# shouldn't fail; if it ever does we simply propagate the exception
# to terminate the program.
......@@ -1463,7 +1466,19 @@ class Xfrin:
def _datasrc_config_handler(self, new_config, config_data):
"""Configuration handler of the 'data_sources' module.
The actual handling is deletegated to the DataSrcClientsMgr class;
this method is a simple wrapper.
This is essentially private, but implemented as 'private' so tests
can refer to it; other external use is prohibited.
except isc.server_common.datasrc_clients_mgr.ConfigError as ex:
def shutdown(self):
''' shutdown the xfrin process. the thread which is doing xfrin should be
......@@ -60,6 +60,16 @@ error is given in the log message.
There was an error opening a connection to the master. The error is
shown in the log message.
% XFRIN_DATASRC_CONFIG_ERROR failed to update data source configuration: %1
Configuration for the global data sources is updated, but the update
cannot be applied to xfrin. The xfrin module will still keep running
with the previous configuration, but the cause of the failure and
other log messages must be carefully examined because if only xfrin
rejects the new configuration then the entire BIND 10 system will have
inconsistent state among different modules. If other modules accept
the update but xfrin produces this error, the xfrin module should
probably be restarted.
The xfrin daemon is exiting.
Supports Markdown
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