]
},
{ 'type': 'memory',
- 'class': 'CH',
+ 'class': 'ch',
'zones': [
{ 'origin': 'example.com',
'filetype': 'sqlite3' }
# make sure it is case insensitive, root-dot-insensitive,
# and supports CLASSXXX notation
self.assertTrue(self.xfr._is_memory_zone("EXAMPLE.com", "IN"))
+ self.assertTrue(self.xfr._is_memory_zone("example.com", "in"))
self.assertTrue(self.xfr._is_memory_zone("example2.com.", "IN"))
self.assertTrue(self.xfr._is_memory_zone("example.com", "CLASS3"))
self.assertFalse(self.xfr._is_memory_zone("example3.com", "IN"))
self.assertTrue(self.xfr._is_memory_zone("example.com", "CH"))
-
-
-
def raise_interrupt():
raise KeyboardInterrupt()
"""Returns true if the given zone/class combination is configured
in the in-memory datasource of the Auth process with file type
'sqlite3'.
+ Note: this method is not thread-safe. We are considering
+ changing the threaded model here, but if we do not, take
+ care in accessing and updating the memory zone set (or add
+ locks)
"""
# Normalize them first, if either conversion fails, return false
# (they won't be in the set anyway)
return False
return (zone_name_str, zone_class_str) in self._memory_zones
- def _add_memory_zone(self, zone_name_str, zone_class_str):
- """Add the given zone and class to the internal list of zones
- in memory datasources with file type 'sqlite3'"""
- self._memory_zones.add((zone_name_str, zone_class_str))
-
def _set_memory_zones(self, new_config, config_data):
"""Part of the _auth_config_handler function, keeps an internal set
of zones in the datasources config subset that have 'sqlite3' as
- their file type"""
+ their file type.
+ Note: this method is not thread-safe. We are considering
+ changing the threaded model here, but if we do not, take
+ care in accessing and updating the memory zone set (or add
+ locks)
+ """
# walk through the data and collect the memory zones
# If this causes any exception, assume we were passed bad data
# and keep the original set
new_memory_zones.add((zone_name_str,
ds_class.to_text()))
# Ok, we can use the data, update our list
- self._clear_memory_zones()
- for zone_str, class_str in new_memory_zones:
- self._add_memory_zone(zone_str, class_str)
- except Exception as eee:
+ self._memory_zones = new_memory_zones
+ except Exception:
# Something is wrong with the data. If this data even reached us,
# we cannot do more than assume the real module has logged and
# reported an error. Keep the old set.
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
+ # This should be hidden inside the data source library and/or
+ # done as a configuration, and this special case should be gone).
db_file = os.environ["B10_FROM_BUILD"] + os.sep +\
"bind10_zones.sqlite3"
self._db_file = db_file