From ea94dcbc23783ec39e6498e98a34bba7d7a885ff Mon Sep 17 00:00:00 2001 From: John Eckersberg Date: Fri, 6 Feb 2009 10:46:43 -0500 Subject: 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. --- cobbler/modules/manage_bind.py | 16 ++++++++++++++-- 1 file 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: -- cgit