|
@@ -1246,6 +1246,10 @@ class Xfrin:
|
|
def __init__(self):
|
|
def __init__(self):
|
|
self._max_transfers_in = 10
|
|
self._max_transfers_in = 10
|
|
self._zones = {}
|
|
self._zones = {}
|
|
|
|
+ # keep a separate list so we can more easily update either for now
|
|
|
|
+ # these are the zones that are served by the in-memory datasource,
|
|
|
|
+ # but transfers are handled by sqlite3
|
|
|
|
+ self._memory_zones = {}
|
|
self._cc_setup()
|
|
self._cc_setup()
|
|
self.recorder = XfrinRecorder()
|
|
self.recorder = XfrinRecorder()
|
|
self._shutdown_event = threading.Event()
|
|
self._shutdown_event = threading.Event()
|
|
@@ -1264,6 +1268,8 @@ class Xfrin:
|
|
self._module_cc.start()
|
|
self._module_cc.start()
|
|
config_data = self._module_cc.get_full_config()
|
|
config_data = self._module_cc.get_full_config()
|
|
self.config_handler(config_data)
|
|
self.config_handler(config_data)
|
|
|
|
+ self._module_cc.add_remote_config(AUTH_SPECFILE_LOCATION,
|
|
|
|
+ self.auth_config_handler)
|
|
|
|
|
|
def _cc_check_command(self):
|
|
def _cc_check_command(self):
|
|
'''This is a straightforward wrapper for cc.check_command,
|
|
'''This is a straightforward wrapper for cc.check_command,
|
|
@@ -1310,10 +1316,16 @@ class Xfrin:
|
|
|
|
|
|
return create_answer(0)
|
|
return create_answer(0)
|
|
|
|
|
|
|
|
+ def auth_config_handler(self, new_config, foo):
|
|
|
|
+ # Config handler for changes in Auth configuration
|
|
|
|
+ print("[XX] Hi. XFRIN HERE. AUTH CONFIG UPDATE")
|
|
|
|
+ self._set_db_file()
|
|
|
|
+
|
|
def shutdown(self):
|
|
def shutdown(self):
|
|
''' shutdown the xfrin process. the thread which is doing xfrin should be
|
|
''' shutdown the xfrin process. the thread which is doing xfrin should be
|
|
terminated.
|
|
terminated.
|
|
'''
|
|
'''
|
|
|
|
+ self._module_cc.remove_remote_config(AUTH_SPECFILE_LOCATION)
|
|
self._module_cc.send_stopping()
|
|
self._module_cc.send_stopping()
|
|
self._shutdown_event.set()
|
|
self._shutdown_event.set()
|
|
main_thread = threading.currentThread()
|
|
main_thread = threading.currentThread()
|
|
@@ -1446,20 +1458,18 @@ class Xfrin:
|
|
return (addr.family, socket.SOCK_STREAM, (str(addr), port))
|
|
return (addr.family, socket.SOCK_STREAM, (str(addr), port))
|
|
|
|
|
|
def _get_db_file(self):
|
|
def _get_db_file(self):
|
|
- #TODO, the db file path should be got in auth server's configuration
|
|
|
|
- # if we need access to this configuration more often, we
|
|
|
|
- # should add it on start, and not remove it here
|
|
|
|
- # (or, if we have writable ds, we might not need this in
|
|
|
|
- # the first place)
|
|
|
|
- self._module_cc.add_remote_config(AUTH_SPECFILE_LOCATION)
|
|
|
|
- db_file, is_default = self._module_cc.get_remote_config_value("Auth", "database_file")
|
|
|
|
|
|
+ return self._db_file
|
|
|
|
+
|
|
|
|
+ def _set_db_file(self):
|
|
|
|
+ db_file, is_default =\
|
|
|
|
+ self._module_cc.get_remote_config_value("Auth", "database_file")
|
|
if is_default and "B10_FROM_BUILD" in os.environ:
|
|
if is_default and "B10_FROM_BUILD" in os.environ:
|
|
# this too should be unnecessary, but currently the
|
|
# this too should be unnecessary, but currently the
|
|
# 'from build' override isn't stored in the config
|
|
# 'from build' override isn't stored in the config
|
|
# (and we don't have writable datasources yet)
|
|
# (and we don't have writable datasources yet)
|
|
- db_file = os.environ["B10_FROM_BUILD"] + os.sep + "bind10_zones.sqlite3"
|
|
|
|
- self._module_cc.remove_remote_config(AUTH_SPECFILE_LOCATION)
|
|
|
|
- return db_file
|
|
|
|
|
|
+ db_file = os.environ["B10_FROM_BUILD"] + os.sep +\
|
|
|
|
+ "bind10_zones.sqlite3"
|
|
|
|
+ self._db_file = db_file
|
|
|
|
|
|
def publish_xfrin_news(self, zone_name, zone_class, xfr_result):
|
|
def publish_xfrin_news(self, zone_name, zone_class, xfr_result):
|
|
'''Send command to xfrout/zone manager module.
|
|
'''Send command to xfrout/zone manager module.
|