BIND 10 trac670, updated. 47b51ddc032a458b42454c3ed774bf26ef4254c1 [trac670] Be tolerant to missing final dot

BIND 10 source code commits bind10-changes at lists.isc.org
Tue Apr 5 17:00:14 UTC 2011


The branch, trac670 has been updated
       via  47b51ddc032a458b42454c3ed774bf26ef4254c1 (commit)
       via  c139d4bf6b30d7ad9325c7a621911c9455826f6b (commit)
      from  ddfc6892916bc041e53b79a690abbed10ff99056 (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 47b51ddc032a458b42454c3ed774bf26ef4254c1
Author: Michal 'vorner' Vaner <michal.vaner at nic.cz>
Date:   Tue Apr 5 18:54:12 2011 +0200

    [trac670] Be tolerant to missing final dot

commit c139d4bf6b30d7ad9325c7a621911c9455826f6b
Author: Michal 'vorner' Vaner <michal.vaner at nic.cz>
Date:   Tue Apr 5 18:43:55 2011 +0200

    [trac670] Dict has it's own .copy()
    
    No need for external one.

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

Summary of changes:
 src/bin/zonemgr/tests/zonemgr_test.py |    5 +++++
 src/bin/zonemgr/zonemgr.py.in         |   11 +++++++----
 2 files changed, 12 insertions(+), 4 deletions(-)

-----------------------------------------------------------------------
diff --git a/src/bin/zonemgr/tests/zonemgr_test.py b/src/bin/zonemgr/tests/zonemgr_test.py
index 4826066..2e9f685 100644
--- a/src/bin/zonemgr/tests/zonemgr_test.py
+++ b/src/bin/zonemgr/tests/zonemgr_test.py
@@ -460,6 +460,11 @@ class TestZonemgrRefresh(unittest.TestCase):
         # So it should not affect the old ones
         self.assertTrue(("sd.cn.", "IN") in
                         self.zone_refresh._zonemgr_refresh_info)
+        # Make sure it works even when we "accidentally" forget the final dot
+        config.set_zone_list_from_name_classes([("sd.cn", "IN")])
+        self.zone_refresh.update_config_data(config)
+        self.assertTrue(("sd.cn.", "IN") in
+                        self.zone_refresh._zonemgr_refresh_info)
 
     def tearDown(self):
         sys.stderr= self.stderr_backup
diff --git a/src/bin/zonemgr/zonemgr.py.in b/src/bin/zonemgr/zonemgr.py.in
index 0e62ab3..edb2e11 100755
--- a/src/bin/zonemgr/zonemgr.py.in
+++ b/src/bin/zonemgr/zonemgr.py.in
@@ -34,7 +34,6 @@ import threading
 import select
 import socket
 import errno
-import copy
 from isc.datasrc import sqlite3_ds
 from optparse import OptionParser, OptionValueError
 from isc.config.ccsession import *
@@ -404,12 +403,16 @@ class ZonemgrRefresh:
 
     def update_config_data(self, new_config):
         """ update ZonemgrRefresh config """
-        backup = copy.copy(self._zonemgr_refresh_info)
+        backup = self._zonemgr_refresh_info.copy()
         try:
             required = {}
             # Add new zones
             for secondary_zone in new_config.get('secondary_zones'):
-                name_class = (secondary_zone['name'], secondary_zone['class'])
+                name = secondary_zone['name']
+                # Be tolerant to sclerotic users who forget the final dot
+                if name[-1] != '.':
+                    name = name + '.'
+                name_class = (name, secondary_zone['class'])
                 required[name_class] = True
                 # Add it only if it isn't there already
                 if not name_class in self._zonemgr_refresh_info:
@@ -483,7 +486,7 @@ class Zonemgr:
         """ Update config data. """
         answer = create_answer(0)
         ok = True
-        complete = copy.copy(self._config_data)
+        complete = self._config_data.copy()
         for key in new_config:
             if key not in complete:
                 answer = create_answer(1, "Unknown config data: " + str(key))




More information about the bind10-changes mailing list