BIND 10 master, updated. 298f5f2ec683b78ddd7d3b57d04add89314a53d1 Merge branch 'trac759'
BIND 10 source code commits
bind10-changes at lists.isc.org
Wed Jun 29 07:21:13 UTC 2011
The branch, master has been updated
via 298f5f2ec683b78ddd7d3b57d04add89314a53d1 (commit)
via b9da1875519a8912f689a695bcb65b8d2f94f0a0 (commit)
via acf0cc6205835bcee35ee276b5cbff285486a763 (commit)
via 92e916b4fe00c6a544121616a401d0d5ea125686 (commit)
via 91bab51181c8ebc89e0ee2e735cc6e851eb6b93d (commit)
via 55c3df5bf10aac9f15735589142b197e4616e0ae (commit)
via d6cddde949ca816c12c182066afd5057eb726b86 (commit)
from 0a4318b47384909ac7d922c065f38f46790db640 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commit 298f5f2ec683b78ddd7d3b57d04add89314a53d1
Merge: 0a4318b47384909ac7d922c065f38f46790db640 b9da1875519a8912f689a695bcb65b8d2f94f0a0
Author: Jelte Jansen <jelte at isc.org>
Date: Wed Jun 29 09:11:56 2011 +0200
Merge branch 'trac759'
-----------------------------------------------------------------------
Summary of changes:
src/bin/bind10/run_bind10.sh.in | 2 +-
src/bin/cfgmgr/b10-cfgmgr.py.in | 12 +++--
src/bin/cfgmgr/tests/Makefile.am | 2 +-
src/lib/python/isc/config/Makefile.am | 9 ++++
src/lib/python/isc/config/cfgmgr.py | 36 +++++++++++++----
src/lib/python/isc/config/cfgmgr_messages.mes | 50 +++++++++++++++++++++++++
src/lib/python/isc/config/tests/Makefile.am | 2 +-
7 files changed, 96 insertions(+), 17 deletions(-)
create mode 100644 src/lib/python/isc/config/cfgmgr_messages.mes
-----------------------------------------------------------------------
diff --git a/src/bin/bind10/run_bind10.sh.in b/src/bin/bind10/run_bind10.sh.in
index 8dfdd50..4020593 100755
--- a/src/bin/bind10/run_bind10.sh.in
+++ b/src/bin/bind10/run_bind10.sh.in
@@ -23,7 +23,7 @@ BIND10_PATH=@abs_top_builddir@/src/bin/bind10
PATH=@abs_top_builddir@/src/bin/msgq:@abs_top_builddir@/src/bin/auth:@abs_top_builddir@/src/bin/resolver:@abs_top_builddir@/src/bin/cfgmgr:@abs_top_builddir@/src/bin/cmdctl:@abs_top_builddir@/src/bin/stats:@abs_top_builddir@/src/bin/xfrin:@abs_top_builddir@/src/bin/xfrout:@abs_top_builddir@/src/bin/zonemgr:@abs_top_builddir@/src/bin/dhcp6:$PATH
export PATH
-PYTHONPATH=@abs_top_builddir@/src/lib/python:@abs_top_builddir@/src/lib/dns/python/.libs:@abs_top_builddir@/src/lib/xfr/.libs:@abs_top_builddir@/src/lib/log/.libs:@abs_top_builddir@/src/lib/util/io/.libs
+PYTHONPATH=@abs_top_builddir@/src/lib/python:@abs_top_builddir@/src/lib/dns/python/.libs:@abs_top_builddir@/src/lib/xfr/.libs:@abs_top_builddir@/src/lib/log/.libs:@abs_top_builddir@/src/lib/util/io/.libs:@abs_top_builddir@/src/lib/python/isc/config
export PYTHONPATH
# If necessary (rare cases), explicitly specify paths to dynamic libraries
diff --git a/src/bin/cfgmgr/b10-cfgmgr.py.in b/src/bin/cfgmgr/b10-cfgmgr.py.in
index d91dfca..8befbdf 100755
--- a/src/bin/cfgmgr/b10-cfgmgr.py.in
+++ b/src/bin/cfgmgr/b10-cfgmgr.py.in
@@ -17,7 +17,6 @@
import sys; sys.path.append ('@@PYTHONPATH@@')
-from isc.config.cfgmgr import ConfigManager, ConfigManagerDataReadError
import bind10_config
from isc.cc import SessionError
import isc.util.process
@@ -26,6 +25,10 @@ import os
from optparse import OptionParser
import glob
import os.path
+import isc.log
+isc.log.init("b10-cfgmgr")
+from isc.config.cfgmgr import ConfigManager, ConfigManagerDataReadError, logger
+from cfgmgr_messages import *
isc.util.process.rename()
@@ -91,13 +94,12 @@ def main():
cm.notify_boss()
cm.run()
except SessionError as se:
- print("[b10-cfgmgr] Error creating config manager, "
- "is the command channel daemon running?")
+ logger.fatal(CFGMGR_CC_SESSION_ERROR, se)
return 1
except KeyboardInterrupt as kie:
- print("[b10-cfgmgr] Interrupted, exiting")
+ logger.info(CFGMGR_STOPPED_BY_KEYBOARD)
except ConfigManagerDataReadError as cmdre:
- print("[b10-cfgmgr] " + str(cmdre))
+ logger.fatal(CFGMGR_DATA_READ_ERROR, cmdre)
return 2
return 0
diff --git a/src/bin/cfgmgr/tests/Makefile.am b/src/bin/cfgmgr/tests/Makefile.am
index 9f80e5d..bd67241 100644
--- a/src/bin/cfgmgr/tests/Makefile.am
+++ b/src/bin/cfgmgr/tests/Makefile.am
@@ -21,7 +21,7 @@ endif
echo Running test: $$pytest ; \
env TESTDATA_PATH=$(abs_srcdir)/testdata \
$(LIBRARY_PATH_PLACEHOLDER) \
- env PYTHONPATH=$(abs_top_srcdir)/src/lib/python:$(abs_top_builddir)/src/lib/python:$(abs_top_builddir)/src/bin/cfgmgr \
+ env PYTHONPATH=$(abs_top_srcdir)/src/lib/python:$(abs_top_builddir)/src/lib/python:$(abs_top_builddir)/src/bin/cfgmgr:$(abs_top_builddir)/src/lib/python/isc/config \
$(PYCOVERAGE_RUN) $(abs_builddir)/$$pytest || exit ; \
done
diff --git a/src/lib/python/isc/config/Makefile.am b/src/lib/python/isc/config/Makefile.am
index 516d069..1efb6fc 100644
--- a/src/lib/python/isc/config/Makefile.am
+++ b/src/lib/python/isc/config/Makefile.am
@@ -1,10 +1,19 @@
SUBDIRS = . tests
python_PYTHON = __init__.py ccsession.py cfgmgr.py config_data.py module_spec.py
+pyexec_DATA = cfgmgr_messages.py
pythondir = $(pyexecdir)/isc/config
+# Define rule to build logging source files from message file
+cfgmgr_messages.py: cfgmgr_messages.mes
+ $(top_builddir)/src/lib/log/compiler/message -p $(top_srcdir)/src/lib/python/isc/config/cfgmgr_messages.mes
+
+CLEANFILES = cfgmgr_messages.py cfgmgr_messages.pyc
+
CLEANDIRS = __pycache__
+EXTRA_DIST = cfgmgr_messages.mes
+
clean-local:
rm -rf $(CLEANDIRS)
diff --git a/src/lib/python/isc/config/cfgmgr.py b/src/lib/python/isc/config/cfgmgr.py
index f46daf8..83db159 100644
--- a/src/lib/python/isc/config/cfgmgr.py
+++ b/src/lib/python/isc/config/cfgmgr.py
@@ -28,7 +28,13 @@ import tempfile
import json
import errno
from isc.cc import data
-from isc.config import ccsession, config_data
+from isc.config import ccsession, config_data, module_spec
+from isc.util.file import path_search
+import bind10_config
+import isc.log
+from cfgmgr_messages import *
+
+logger = isc.log.Logger("cfgmgr")
class ConfigManagerDataReadError(Exception):
"""This exception is thrown when there is an error while reading
@@ -89,7 +95,7 @@ class ConfigManagerData:
elif file_config['version'] == 1:
# only format change, no other changes necessary
file_config['version'] = 2
- print("[b10-cfgmgr] Updating configuration database version from 1 to 2")
+ logger.info(CFGMGR_AUTOMATIC_CONFIG_DATABASE_UPDATE, 1, 2)
config.data = file_config
else:
if config_data.BIND10_CONFIG_DATA_VERSION > file_config['version']:
@@ -131,12 +137,9 @@ class ConfigManagerData:
else:
os.rename(filename, self.db_filename)
except IOError as ioe:
- # TODO: log this (level critical)
- print("[b10-cfgmgr] Unable to write configuration file; configuration not stored: " + str(ioe))
- # TODO: debug option to keep file?
+ logger.error(CFGMGR_IOERROR_WHILE_WRITING_CONFIGURATION, ioe)
except OSError as ose:
- # TODO: log this (level critical)
- print("[b10-cfgmgr] Unable to write configuration file; configuration not stored: " + str(ose))
+ logger.error(CFGMGR_OSERROR_WHILE_WRITING_CONFIGURATION, ose)
try:
if filename and os.path.exists(filename):
os.remove(filename)
@@ -182,6 +185,20 @@ class ConfigManager:
self.cc.group_subscribe("ConfigManager")
self.cc.group_subscribe("Boss", "ConfigManager")
self.running = False
+ # As a core module, CfgMgr is different than other modules,
+ # as it does not use a ModuleCCSession, and hence needs
+ # to handle logging config on its own
+ self.log_config_data = config_data.ConfigData(
+ isc.config.module_spec_from_file(
+ path_search('logging.spec',
+ bind10_config.PLUGIN_PATHS)))
+ # store the logging 'module' name for easier reference
+ self.log_module_name = self.log_config_data.get_module_spec().get_module_name()
+
+ def check_logging_config(self, config):
+ if self.log_module_name in config:
+ ccsession.default_logconfig_handler(config[self.log_module_name],
+ self.log_config_data)
def notify_boss(self):
"""Notifies the Boss module that the Config Manager is running"""
@@ -256,6 +273,7 @@ class ConfigManager:
self.config = ConfigManagerData.read_from_file(self.data_path,
self.\
database_filename)
+ self.check_logging_config(self.config.data);
except ConfigManagerDataEmpty:
# ok, just start with an empty config
self.config = ConfigManagerData(self.data_path,
@@ -388,6 +406,8 @@ class ConfigManager:
got_error = True
err_list.append(val)
if not got_error:
+ # if Logging config is in there, update our config as well
+ self.check_logging_config(cmd);
self.write_config()
return ccsession.create_answer(0)
else:
@@ -441,8 +461,6 @@ class ConfigManager:
elif cmd == ccsession.COMMAND_SET_CONFIG:
answer = self._handle_set_config(arg)
elif cmd == ccsession.COMMAND_SHUTDOWN:
- # TODO: logging
- #print("[b10-cfgmgr] Received shutdown command")
self.running = False
answer = ccsession.create_answer(0)
elif cmd == ccsession.COMMAND_MODULE_SPEC:
diff --git a/src/lib/python/isc/config/cfgmgr_messages.mes b/src/lib/python/isc/config/cfgmgr_messages.mes
new file mode 100644
index 0000000..9355e4d
--- /dev/null
+++ b/src/lib/python/isc/config/cfgmgr_messages.mes
@@ -0,0 +1,50 @@
+# Copyright (C) 2011 Internet Systems Consortium, Inc. ("ISC")
+#
+# Permission to use, copy, modify, and/or distribute this software for any
+# purpose with or without fee is hereby granted, provided that the above
+# copyright notice and this permission notice appear in all copies.
+#
+# THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
+# REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
+# AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
+# INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
+# LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
+# OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+# PERFORMANCE OF THIS SOFTWARE.
+
+# No namespace declaration - these constants go in the global namespace
+# of the xfrin messages python module.
+
+% CFGMGR_AUTOMATIC_CONFIG_DATABASE_UPDATE Updating configuration database from version %1 to %2
+An older version of the configuration database has been found, from which
+there was an automatic upgrade path to the current version. These changes
+are now applied, and no action from the administrator is necessary.
+
+% CFGMGR_CC_SESSION_ERROR Error connecting to command channel: %1
+The configuration manager daemon was unable to connect to the messaging
+system. The most likely cause is that msgq is not running.
+
+% CFGMGR_DATA_READ_ERROR error reading configuration database from disk: %1
+There was a problem reading the persistent configuration data as stored
+on disk. The file may be corrupted, or it is of a version from where
+there is no automatic upgrade path. The file needs to be repaired or
+removed. The configuration manager daemon will now shut down.
+
+% CFGMGR_IOERROR_WHILE_WRITING_CONFIGURATION Unable to write configuration file; configuration not stored: %1
+There was an IO error from the system while the configuration manager
+was trying to write the configuration database to disk. The specific
+error is given. The most likely cause is that the directory where
+the file is stored does not exist, or is not writable. The updated
+configuration is not stored.
+
+% CFGMGR_OSERROR_WHILE_WRITING_CONFIGURATION Unable to write configuration file; configuration not stored: %1
+There was an OS error from the system while the configuration manager
+was trying to write the configuration database to disk. The specific
+error is given. The most likely cause is that the system does not have
+write access to the configuration database file. The updated
+configuration is not stored.
+
+% CFGMGR_STOPPED_BY_KEYBOARD keyboard interrupt, shutting down
+There was a keyboard interrupt signal to stop the cfgmgr daemon. The
+daemon will now shut down.
+
diff --git a/src/lib/python/isc/config/tests/Makefile.am b/src/lib/python/isc/config/tests/Makefile.am
index b5f5501..47ccc41 100644
--- a/src/lib/python/isc/config/tests/Makefile.am
+++ b/src/lib/python/isc/config/tests/Makefile.am
@@ -21,7 +21,7 @@ endif
for pytest in $(PYTESTS) ; do \
echo Running test: $$pytest ; \
$(LIBRARY_PATH_PLACEHOLDER) \
- env PYTHONPATH=$(abs_top_srcdir)/src/lib/python:$(abs_top_builddir)/src/lib/python \
+ env PYTHONPATH=$(abs_top_srcdir)/src/lib/python:$(abs_top_builddir)/src/lib/python:$(abs_top_builddir)/src/lib/python/isc/config \
B10_TEST_PLUGIN_DIR=$(abs_top_srcdir)/src/bin/cfgmgr/plugins \
CONFIG_TESTDATA_PATH=$(abs_top_srcdir)/src/lib/config/tests/testdata \
CONFIG_WR_TESTDATA_PATH=$(abs_top_builddir)/src/lib/config/tests/testdata \
More information about the bind10-changes
mailing list