summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJohn Eckersberg <jeckersb@redhat.com>2009-02-06 10:46:43 -0500
committerJohn Eckersberg <jeckersb@redhat.com>2009-02-06 10:46:43 -0500
commitea94dcbc23783ec39e6498e98a34bba7d7a885ff (patch)
treeebc074ac7fa2f6301aa1a574ea6e845bd969fed3
parente936148a8c215bce88fd81e4b559ad5d6c19c7af (diff)
downloadcobbler-ea94dcbc23783ec39e6498e98a34bba7d7a885ff.tar.gz
cobbler-ea94dcbc23783ec39e6498e98a34bba7d7a885ff.tar.xz
cobbler-ea94dcbc23783ec39e6498e98a34bba7d7a885ff.zip
Gracefully handle manage_*_zones settings as strings.
Previously if these settings were not a valid YAML array it would cause an exception. Now we will check to see if the setting is of type(List). If not we assume it's just a single string.
-rw-r--r--cobbler/modules/manage_bind.py16
1 files changed, 14 insertions, 2 deletions
diff --git a/cobbler/modules/manage_bind.py b/cobbler/modules/manage_bind.py
index 5acbf208..657a9a77 100644
--- a/cobbler/modules/manage_bind.py
+++ b/cobbler/modules/manage_bind.py
@@ -81,7 +81,13 @@ class BindManager:
in them
"""
zones = {}
- for zone in self.settings.manage_forward_zones:
+ forward_zones = self.settings.manage_forward_zones
+ if type(forward_zones) != type([]):
+ # gracefully handle when user inputs only a single zone
+ # as a string instead of a list with only a single item
+ forward_zones = [forward_zones]
+
+ for zone in forward_zones:
zones[zone] = {}
for system in self.systems:
@@ -125,7 +131,13 @@ class BindManager:
in them
"""
zones = {}
- for zone in self.settings.manage_reverse_zones:
+ reverse_zones = self.settings.manage_reverse_zones
+ if type(reverse_zones) != type([]):
+ # gracefully handle when user inputs only a single zone
+ # as a string instead of a list with only a single item
+ reverse_zones = [reverse_zones]
+
+ for zone in reverse_zones:
zones[zone] = {}
for sys in self.systems: