From 117a32ecd4668fceccb4b1bd5c65c438293acff3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tor=20Martin=20Sl=C3=A5en?= Date: Sun, 8 May 2011 22:24:29 +0200 Subject: [PATCH] fixed bug where script would crash if zone validation fails. --- scripts/zone_synchronizer.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/scripts/zone_synchronizer.py b/scripts/zone_synchronizer.py index c9f6bed..b6eecfe 100755 --- a/scripts/zone_synchronizer.py +++ b/scripts/zone_synchronizer.py @@ -41,6 +41,8 @@ def check_zone(zone, filename): status, output = getstatusoutput(zone_check_command % (zone, filename)) retval['value'] = status retval['output'] = output + if debugging and status != 0: + print output return retval @@ -63,8 +65,8 @@ for domain in Domain.objects.all(): if result['value'] != 0: sys.stdout.write("fail\n") log = open(error_log_file % (domain.domain_name, \ - domain.domain_serial)) - log.write(output) + domain.domain_serial), "w") + log.write(domain.zone_file_contents()) log.close() continue @@ -99,8 +101,8 @@ for subnet in Ip4Subnet.objects.all(): if result['value'] != 0: sys.stdout.write("fail\n") log = open(error_log_file % (subnet.domain_name, \ - subnet.domain_serial)) - log.write(output) + subnet.domain_serial), "w") + log.write(subnet.zone_file_contents()) log.close() continue