BIND 10 master, updated. a807c0d3ef2c845efdc1dae050cf52f951c21cbf [master] update changelog for merge of #1889
BIND 10 source code commits
bind10-changes at lists.isc.org
Tue May 15 09:53:26 UTC 2012
The branch, master has been updated
via a807c0d3ef2c845efdc1dae050cf52f951c21cbf (commit)
via ce7d1aef2ca88084e4dacef97132337dd3e50d6c (commit)
via 75bfd569cd3a7fdadf72bab974a5303fcc1c0575 (commit)
from ce461b1b1bb0bc412e92ffc41365cb86d5544736 (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 a807c0d3ef2c845efdc1dae050cf52f951c21cbf
Author: Jelte Jansen <jelte at isc.org>
Date: Tue May 15 11:53:13 2012 +0200
[master] update changelog for merge of #1889
commit ce7d1aef2ca88084e4dacef97132337dd3e50d6c
Merge: ce461b1b1bb0bc412e92ffc41365cb86d5544736 75bfd569cd3a7fdadf72bab974a5303fcc1c0575
Author: Jelte Jansen <jelte at isc.org>
Date: Tue May 15 11:51:35 2012 +0200
[master] Merge branch 'trac1889'
-----------------------------------------------------------------------
Summary of changes:
ChangeLog | 5 ++++
src/bin/cfgmgr/b10-cfgmgr.py.in | 33 ++++++++++++++++++++++---
src/bin/cfgmgr/tests/b10-cfgmgr_test.py.in | 23 +++++++++++++----
src/lib/python/isc/config/cfgmgr.py | 1 +
src/lib/python/isc/config/cfgmgr_messages.mes | 4 +++
5 files changed, 56 insertions(+), 10 deletions(-)
-----------------------------------------------------------------------
diff --git a/ChangeLog b/ChangeLog
index 8e02216..9edd4f9 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+436. [bug] jelte
+ The --config-file option now works correctly with relative paths if
+ --data-path is not given.
+ (Trac #1889, git ce7d1aef2ca88084e4dacef97132337dd3e50d6c)
+
435. [func] team
The in-memory datasource now supports NSEC-signed zones.
(Trac #1802-#1810, git 2f9aa4a553a05aa1d9eac06f1140d78f0c99408b)
diff --git a/src/bin/cfgmgr/b10-cfgmgr.py.in b/src/bin/cfgmgr/b10-cfgmgr.py.in
index 760b6d8..f1d0308 100755
--- a/src/bin/cfgmgr/b10-cfgmgr.py.in
+++ b/src/bin/cfgmgr/b10-cfgmgr.py.in
@@ -44,11 +44,11 @@ def parse_options(args=sys.argv[1:], Parser=OptionParser):
parser = Parser()
parser.add_option("-p", "--data-path", dest="data_path",
help="Directory to search for configuration files " +
- "(default=" + DATA_PATH + ")", default=DATA_PATH)
+ "(default=" + DATA_PATH + ")", default=None)
parser.add_option("-c", "--config-filename", dest="config_file",
help="Configuration database filename " +
"(default=" + DEFAULT_CONFIG_FILE + ")",
- default=DEFAULT_CONFIG_FILE)
+ default=None)
parser.add_option("--clear-config", action="store_true",
dest="clear_config", default=False,
help="Back up the configuration file and start with " +
@@ -85,12 +85,37 @@ def load_plugins(path, cm):
# Restore the search path
sys.path = sys.path[1:]
+
+def determine_path_and_file(data_path_option, config_file_option):
+ """Given the data path and config file as specified on the command line
+ (or not specified, as may be the case), determine the full path and
+ file to use when starting the config manager;
+ - if neither are given, use defaults
+ - if both are given, use both
+ - if only data path is given, use default file in that path
+ - if only file is given, use cwd() + file (if file happens to
+ be an absolute file name, path will be ignored)
+ Arguments are either a string, or None.
+ Returns a tuple containing (result_path, result_file).
+ """
+ data_path = data_path_option
+ config_file = config_file_option
+ if config_file is None:
+ config_file = DEFAULT_CONFIG_FILE
+ if data_path is None:
+ data_path = DATA_PATH
+ else:
+ if data_path is None:
+ data_path = os.getcwd()
+ return (data_path, config_file)
+
def main():
options = parse_options()
global cm
try:
- cm = ConfigManager(options.data_path, options.config_file,
- None, options.clear_config)
+ (data_path, config_file) = determine_path_and_file(options.data_path,
+ options.config_file)
+ cm = ConfigManager(data_path, config_file, None, options.clear_config)
signal.signal(signal.SIGINT, signal_handler)
signal.signal(signal.SIGTERM, signal_handler)
cm.read_config()
diff --git a/src/bin/cfgmgr/tests/b10-cfgmgr_test.py.in b/src/bin/cfgmgr/tests/b10-cfgmgr_test.py.in
index ca91c9c..66d8f2a 100644
--- a/src/bin/cfgmgr/tests/b10-cfgmgr_test.py.in
+++ b/src/bin/cfgmgr/tests/b10-cfgmgr_test.py.in
@@ -141,8 +141,8 @@ class TestParseArgs(unittest.TestCase):
# Pass it empty array, not our arguments
b = __import__("b10-cfgmgr")
parsed = b.parse_options([], TestOptParser)
- self.assertEqual(b.DATA_PATH, parsed.data_path)
- self.assertEqual(b.DEFAULT_CONFIG_FILE, parsed.config_file)
+ self.assertEqual(None, parsed.data_path)
+ self.assertEqual(None, parsed.config_file)
def test_wrong_args(self):
"""
@@ -168,10 +168,10 @@ class TestParseArgs(unittest.TestCase):
b = __import__("b10-cfgmgr")
parsed = b.parse_options(['--data-path=/path'], TestOptParser)
self.assertEqual('/path', parsed.data_path)
- self.assertEqual(b.DEFAULT_CONFIG_FILE, parsed.config_file)
+ self.assertEqual(None, parsed.config_file)
parsed = b.parse_options(['-p', '/path'], TestOptParser)
self.assertEqual('/path', parsed.data_path)
- self.assertEqual(b.DEFAULT_CONFIG_FILE, parsed.config_file)
+ self.assertEqual(None, parsed.config_file)
self.assertRaises(OptsError, b.parse_options, ['-p'], TestOptParser)
self.assertRaises(OptsError, b.parse_options, ['--data-path'],
TestOptParser)
@@ -183,15 +183,26 @@ class TestParseArgs(unittest.TestCase):
b = __import__("b10-cfgmgr")
parsed = b.parse_options(['--config-filename=filename'],
TestOptParser)
- self.assertEqual(b.DATA_PATH, parsed.data_path)
+ self.assertEqual(None, parsed.data_path)
self.assertEqual("filename", parsed.config_file)
parsed = b.parse_options(['-c', 'filename'], TestOptParser)
- self.assertEqual(b.DATA_PATH, parsed.data_path)
+ self.assertEqual(None, parsed.data_path)
self.assertEqual("filename", parsed.config_file)
self.assertRaises(OptsError, b.parse_options, ['-c'], TestOptParser)
self.assertRaises(OptsError, b.parse_options, ['--config-filename'],
TestOptParser)
+ def test_determine_path_and_file(self):
+ b = __import__("b10-cfgmgr")
+ self.assertEqual((b.DATA_PATH, b.DEFAULT_CONFIG_FILE),
+ b.determine_path_and_file(None, None))
+ self.assertEqual(("/foo", b.DEFAULT_CONFIG_FILE),
+ b.determine_path_and_file("/foo", None))
+ self.assertEqual((os.getcwd(), "file.config"),
+ b.determine_path_and_file(None, "file.config"))
+ self.assertEqual(("/foo", "bar"),
+ b.determine_path_and_file("/foo", "bar"))
+
def test_clear_config(self):
b = __import__("b10-cfgmgr")
parsed = b.parse_options([], TestOptParser)
diff --git a/src/lib/python/isc/config/cfgmgr.py b/src/lib/python/isc/config/cfgmgr.py
index 9f9ce68..23e627e 100644
--- a/src/lib/python/isc/config/cfgmgr.py
+++ b/src/lib/python/isc/config/cfgmgr.py
@@ -81,6 +81,7 @@ class ConfigManagerData:
and stop loading the system.
"""
config = ConfigManagerData(data_path, file_name)
+ logger.info(CFGMGR_CONFIG_FILE, config.db_filename)
file = None
try:
file = open(config.db_filename, 'r')
diff --git a/src/lib/python/isc/config/cfgmgr_messages.mes b/src/lib/python/isc/config/cfgmgr_messages.mes
index ad78be0..e608594 100644
--- a/src/lib/python/isc/config/cfgmgr_messages.mes
+++ b/src/lib/python/isc/config/cfgmgr_messages.mes
@@ -31,6 +31,10 @@ assumed to have failed, and will not be stored.
The configuration manager daemon was unable to connect to the messaging
system. The most likely cause is that msgq is not running.
+% CFGMGR_CONFIG_FILE Configuration manager starting with configuration file: %1
+The configuration manager is starting, reading and saving the configuration
+settings to the shown file.
+
% 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
More information about the bind10-changes
mailing list