knotcExec: abort transition on failure

This commit is contained in:
Miraty 2022-06-10 00:38:05 +02:00
parent e32d3bd1ed
commit a6873d6ea6

View file

@ -8,12 +8,16 @@ function knotcExec($suffix, $cmd) {
serverError("<code>knotc</code> failed with exit code <samp>" . $code['begin'] . "</samp>: <samp>" . $output['begin'][0] . "</samp>.");
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("<code>knotc</code> failed with exit code <samp>" . $code['op'] . "</samp>: <samp>" . $output['op'][0] . "</samp>.");
}
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("<code>knotc</code> failed with exit code <samp>" . $code['commit'] . "</samp>: <samp>" . $output['commit'][0] . "</samp>.");
}
}
function checkIpFormat($ip) {