Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
ISC Open Source Projects
Kea
Commits
23350205
Commit
23350205
authored
Dec 13, 2011
by
Jelte Jansen
Browse files
[1414] address some more comments
parent
ebfebb1b
Changes
2
Hide whitespace changes
Inline
Side-by-side
src/bin/zonemgr/tests/zonemgr_test.py
View file @
23350205
...
...
@@ -551,19 +551,16 @@ class TestZonemgrRefresh(unittest.TestCase):
self
.
zone_refresh
.
update_config_data
(
config
,
self
.
cc_session
)
self
.
assertEqual
(
self
.
zone_refresh
.
_zonemgr_refresh_info
,
{})
# Put something in
#config.set_zone_list_from_name_classes([ZONE_NAME_CLASS1_IN])
config
[
'secondary_zones'
]
=
\
zone_list_from_name_classes
([
ZONE_NAME_CLASS1_IN
])
self
.
zone_refresh
.
update_config_data
(
config
,
self
.
cc_session
)
self
.
assertTrue
((
"example.net."
,
"IN"
)
in
self
.
zone_refresh
.
_zonemgr_refresh_info
)
# This one does not exist
# Reset the data, set to use a different class, and make sure
# it does not get set to IN
config
[
'secondary_zones'
]
=
\
zone_list_from_name_classes
([
"example.net"
,
"
CH
"
])
zone_list_from_name_classes
([
ZONE_NAME_CLASS1_
CH
])
self
.
zone_refresh
.
update_config_data
(
config
,
self
.
cc_session
)
self
.
assertFalse
((
"example.net."
,
"CH"
)
in
self
.
zone_refresh
.
_zonemgr_refresh_info
)
# Simply skip loading soa for the zone, the other configs should be updated successful
self
.
assertFalse
((
"example.net."
,
"IN"
)
in
self
.
zone_refresh
.
_zonemgr_refresh_info
)
# Make sure it works even when we "accidentally" forget the final dot
...
...
@@ -572,6 +569,17 @@ class TestZonemgrRefresh(unittest.TestCase):
self
.
zone_refresh
.
update_config_data
(
config
,
self
.
cc_session
)
self
.
assertTrue
((
"example.net."
,
"IN"
)
in
self
.
zone_refresh
.
_zonemgr_refresh_info
)
# Try some bad names
config
[
'secondary_zones'
]
=
\
zone_list_from_name_classes
([(
"example..net"
,
"IN"
)])
self
.
assertRaises
(
ZonemgrException
,
self
.
zone_refresh
.
update_config_data
,
config
,
self
.
cc_session
)
config
[
'secondary_zones'
]
=
\
zone_list_from_name_classes
([(
""
,
"IN"
)])
self
.
assertRaises
(
ZonemgrException
,
self
.
zone_refresh
.
update_config_data
,
config
,
self
.
cc_session
)
def
tearDown
(
self
):
sys
.
stderr
=
self
.
stderr_backup
...
...
src/bin/zonemgr/zonemgr.py.in
View file @
23350205
...
...
@@ -28,6 +28,7 @@ import os
import time
import signal
import isc
import isc.dns
import random
import threading
import select
...
...
@@ -461,9 +462,16 @@ class ZonemgrRefresh:
raise ZonemgrException("Secondary zone specified "
"without a name")
name = secondary_zone['name']
# Be tolerant to sclerotic users who forget the final dot
if name[-1] != '.':
name = name + '.'
# Convert to Name and back (both to check and to normalize)
try:
name = isc.dns.Name(name, True).to_text()
# Name() can raise a number of different exceptions, just
# catch 'em all.
except Exception as isce:
raise ZonemgrException("Bad zone name '" + name +
"': " + str(isce))
# Currently we use an explicit get_default_value call
# in case the class hasn't been set. Alternatively, we
# could use
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment