BIND 10 master, updated. 73ef6ee5e29c771dac91d5bc453f8daa544ce9ba [master] changelog for merge of #2119

BIND 10 source code commits bind10-changes at lists.isc.org
Sun Jul 22 18:22:02 UTC 2012


The branch, master has been updated
       via  73ef6ee5e29c771dac91d5bc453f8daa544ce9ba (commit)
       via  2f68d7ac5c3c7cc88a3663191113eece32d46a3d (commit)
      from  2015d7fc14dee3abea892ea3bed3d6af6899fb38 (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 73ef6ee5e29c771dac91d5bc453f8daa544ce9ba
Author: Jelte Jansen <jelte at isc.org>
Date:   Sun Jul 22 20:21:44 2012 +0200

    [master] changelog for merge of #2119

commit 2f68d7ac5c3c7cc88a3663191113eece32d46a3d
Author: Jelte Jansen <jelte at isc.org>
Date:   Sun Jul 22 19:20:46 2012 +0200

    [2119] directly import cfgmgr plugins from their source
    
    as opposed to searching the import path; this gives us more flexibility over cfgmgr plugin names, and makes sure they don't conflict with actual modules.

-----------------------------------------------------------------------

Summary of changes:
 ChangeLog                       |    7 +++++++
 src/bin/cfgmgr/b10-cfgmgr.py.in |   28 +++++++++++-----------------
 2 files changed, 18 insertions(+), 17 deletions(-)

-----------------------------------------------------------------------
diff --git a/ChangeLog b/ChangeLog
index 776f14e..bd58aeb 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+454.	[bug]		jelte
+	b10-cfgmgr now loads its configuration check plugins directly from
+	the plugin search path, as opposed to importing them from the
+	general python system module path list; this prevents naming
+	conflicts with real python modules.
+	(Trac #2119, git 2f68d7ac5c3c7cc88a3663191113eece32d46a3d)
+
 453.	[bug]		jelte
 	b10-auth no longer tries to send DDNS UPDATE messages to b10-ddns if
 	b10-ddns is not running. Sending an UPDATE to BIND 10 that is not
diff --git a/src/bin/cfgmgr/b10-cfgmgr.py.in b/src/bin/cfgmgr/b10-cfgmgr.py.in
index f1d0308..a3763c9 100755
--- a/src/bin/cfgmgr/b10-cfgmgr.py.in
+++ b/src/bin/cfgmgr/b10-cfgmgr.py.in
@@ -25,6 +25,7 @@ import os
 from optparse import OptionParser
 import glob
 import os.path
+import imp
 import isc.log
 isc.log.init("b10-cfgmgr")
 from isc.config.cfgmgr import ConfigManager, ConfigManagerDataReadError, logger
@@ -67,23 +68,16 @@ def load_plugins(path, cm):
     """Load all python files in the given path and treat them as plugins."""
     # Find the python files
     plugins = glob.glob(path + os.sep + '*.py')
-    # Search this directory first, but leave the others there for the imports
-    # of the modules
-    sys.path.insert(0, path)
-    try:
-        for plugin in plugins:
-            # Generate the name of the plugin
-            filename = os.path.basename(plugin)
-            name = filename[:-3]
-            # Load it
-            module = __import__(name)
-            # Ask it to provide the spec and checking function
-            (spec, check_func) = module.load()
-            # And insert it into the manager
-            cm.set_virtual_module(spec, check_func)
-    finally:
-        # Restore the search path
-        sys.path = sys.path[1:]
+    for plugin in plugins:
+        # Generate the name of the plugin
+        filename = os.path.basename(plugin)
+        name = filename[:-3]
+        # Load it
+        module = imp.load_source(name, plugin)
+        # Ask it to provide the spec and checking function
+        (spec, check_func) = module.load()
+        # And insert it into the manager
+        cm.set_virtual_module(spec, check_func)
 
 
 def determine_path_and_file(data_path_option, config_file_option):



More information about the bind10-changes mailing list