SPECFILE_LOCATION = SPECFILE_PATH + "/xfrin.spec"
AUTH_SPECFILE_LOCATION = AUTH_SPECFILE_PATH + "/auth.spec"
+AUTH_MODULE_NAME = 'Auth'
XFROUT_MODULE_NAME = 'Xfrout'
ZONE_MANAGER_MODULE_NAME = 'Zonemgr'
REFRESH_FROM_ZONEMGR = 'refresh_from_zonemgr'
def _set_db_file(self):
db_file, is_default =\
- self._module_cc.get_remote_config_value("Auth", "database_file")
+ self._module_cc.get_remote_config_value(AUTH_MODULE_NAME, "database_file")
if is_default and "B10_FROM_BUILD" in os.environ:
# override the local database setting if it is default and we
# are running from the source tree
"bind10_zones.sqlite3"
self._db_file = db_file
- def publish_xfrin_news(self, zone_name, zone_class, xfr_result):
+ def _do_auth_loadzone(self, zone_name, zone_class):
+ # On a successful zone transfer, if the zone is served by
+ # b10-auth in the in-memory data source using sqlite3 as a
+ # backend, send the "loadzone" command for the zone to auth.
+ datasources, is_default =\
+ self._module_cc.get_remote_config_value(AUTH_MODULE_NAME, "datasources")
+ if is_default:
+ return
+ for d in datasources:
+ if d.has_key("class"):
+ dclass = d["class"]
+ else:
+ dclass = "IN"
+ if d["type"].lower() == "memory" and dclass.lower() == zone_class.lower():
+ for zone in d["zones"]:
+ if zone["filetype"].lower() == "sqlite3" and\
+ zone["origin"].lower() == zone_name.lower():
+ param = {"origin": zone_name.to_text(),
+ "class": zone_class.to_text(),
+ "datasrc": d["type"]}
+ logger.debug(XFRIN_AUTH_LOADZONE,
+ param["origin"], param["class"], param["datasrc"])
+
+ msg = create_command("loadzone", param)
+ # catch the exception, in case msgq has been killed.
+ try:
+ seq = self._send_cc_session.group_sendmsg(msg, AUTH_MODULE_NAME)
+ try:
+ answer, env = self._send_cc_session.group_recvmsg(False, seq)
+ except isc.cc.session.SessionTimeout:
+ pass # for now we just ignore the failure
+ except socket.error as err:
+ logger.error(XFRIN_MSGQ_SEND_ERROR_AUTH, AUTH_MODULE_NAME)
+
+ def publish_xfrin_news(self, zone_name, zone_class, xfr_result):
'''Send command to xfrout/zone manager module.
If xfrin has finished successfully for one zone, tell the good
news(command: zone_new_data_ready) to zone manager and xfrout.
pass # for now we just ignore the failure
except socket.error as err:
logger.error(XFRIN_MSGQ_SEND_ERROR, XFROUT_MODULE_NAME, ZONE_MANAGER_MODULE_NAME)
+
+ self._do_auth_loadzone(zone_name, zone_class)
+
else:
msg = create_command(ZONE_XFRIN_FAILED, param)
# catch the exception, in case msgq has been killed.
There was a problem sending a message to the zone manager. This most
likely means that the msgq daemon has quit or was killed.
+% XFRIN_MSGQ_SEND_ERROR_AUTH error while contacting %1
+There was a problem sending a message to b10-auth. This most likely
+means that the msgq daemon has quit or was killed.
+
+% XFRIN_AUTH_LOADZONE sending Auth loadzone for origin=%1, class=%2, datasrc=%3
+There was a successful zone transfer, and the zone is served by b10-auth
+in the in-memory data source using sqlite3 as a backend. We send the
+"loadzone" command for the zone to b10-auth.
+
% XFRIN_NOTIFY_UNKNOWN_MASTER got notification to retransfer zone %1 from %2, expected %3
The system received a notify for the given zone, but the address it came
from does not match the master address in the Xfrin configuration. The notify