Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Sebastian Schrader
Kea
Commits
525021e0
Commit
525021e0
authored
Jun 03, 2013
by
JINMEI Tatuya
Browse files
[2964] make sure to catch exception from DataSrcClientsMgr.reconfigure.
parent
e51d6fd3
Changes
3
Hide whitespace changes
Inline
Side-by-side
src/bin/xfrin/tests/xfrin_test.py
View file @
525021e0
...
...
@@ -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.
self
.
reconfigure_param
.
append
(
arg1
)
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):
self
.
assertEqual
(
ZoneInfo
.
REQUEST_IXFR_DISABLED
,
self
.
xfr
.
xfrin_started_request_ixfr
)
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
)
self
.
assertEqual
([
True
],
self
.
xfr
.
_datasrc_clients_mgr
.
reconfigure_param
)
def
raise_interrupt
():
raise
KeyboardInterrupt
()
...
...
src/bin/xfrin/xfrin.py.in
View file @
525021e0
...
...
@@ -1391,6 +1391,9 @@ class Xfrin:
self._cc_setup()
config_data = self._module_cc.get_full_config()
self.config_handler(config_data)
# 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.
self._module_cc.add_remote_config_by_name('data_sources',
self._datasrc_config_handler)
init_keyring(self._module_cc)
...
...
@@ -1463,7 +1466,19 @@ class Xfrin:
self._set_db_file()
def _datasrc_config_handler(self, new_config, config_data):
self._datasrc_clients_mgr.reconfigure(new_config)
"""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.
"""
try:
self._datasrc_clients_mgr.reconfigure(new_config)
except isc.server_common.datasrc_clients_mgr.ConfigError as ex:
logger.error(XFRIN_DATASRC_CONFIG_ERROR, ex)
def shutdown(self):
''' shutdown the xfrin process. the thread which is doing xfrin should be
...
...
src/bin/xfrin/xfrin_messages.mes
View file @
525021e0
...
...
@@ -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.
% XFRIN_EXITING exiting
The xfrin daemon is exiting.
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment