From a6873d6ea6784bae75964fe4eaf74a13ec4cc11a Mon Sep 17 00:00:00 2001 From: Miraty Date: Fri, 10 Jun 2022 00:38:05 +0200 Subject: [PATCH] knotcExec: abort transition on failure --- fn/dns.php | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/fn/dns.php b/fn/dns.php index 15a4c4a..6476942 100644 --- a/fn/dns.php +++ b/fn/dns.php @@ -8,12 +8,16 @@ function knotcExec($suffix, $cmd) { serverError("knotc failed with exit code " . $code['begin'] . ": " . $output['begin'][0] . "."); exec(CONF['dns']['knotc_path'] . " zone-" . $action . "set " . $suffix . " " . implode(" ", $cmd), $output['op'], $code['op']); - if ($code['op'] !== 0) + if ($code['op'] !== 0) { + exec(CONF['dns']['knotc_path'] . " zone-abort " . $suffix); serverError("knotc failed with exit code " . $code['op'] . ": " . $output['op'][0] . "."); + } exec(CONF['dns']['knotc_path'] . " zone-commit " . $suffix, $output['commit'], $code['commit']); - if ($code['commit'] !== 0) + if ($code['commit'] !== 0) { + exec(CONF['dns']['knotc_path'] . " zone-abort " . $suffix); serverError("knotc failed with exit code " . $code['commit'] . ": " . $output['commit'][0] . "."); + } } function checkIpFormat($ip) {