mirror of
https://gitlab.nic.cz/knot/knot-dns.git
synced 2026-02-03 18:49:28 -05:00
ctl: avoid unrecoverable situation after semcheck error from conf-commit
This commit is contained in:
parent
f57055b434
commit
146d90c03b
2 changed files with 22 additions and 2 deletions
|
|
@ -2228,7 +2228,7 @@ static int ctl_conf_txn(ctl_args_t *args, ctl_cmd_t cmd)
|
|||
if (ret != KNOT_EOK) {
|
||||
// A semantic error is already sent by the check function.
|
||||
if (io.error.code != KNOT_EOK) {
|
||||
return KNOT_EOK;
|
||||
return io.error.code;
|
||||
}
|
||||
// No transaction abort!
|
||||
break;
|
||||
|
|
|
|||
|
|
@ -26,7 +26,6 @@ sockname = knot.ctl_sock_rnd(name_only=True)
|
|||
ctl.connect(os.path.join(knot.dir, sockname))
|
||||
|
||||
# Check conf-abort and conf-commit without conf transaction open.
|
||||
|
||||
ctl.send_block(cmd="conf-abort")
|
||||
resp = ctl.receive_block()
|
||||
|
||||
|
|
@ -38,6 +37,27 @@ except libknot.control.KnotCtlError as exc:
|
|||
else:
|
||||
set_err("UNEXPECTED RETURN")
|
||||
|
||||
# Check repeated conf-commit after fixed semcheck issues.
|
||||
ctl.send_block(cmd="conf-begin")
|
||||
resp = ctl.receive_block()
|
||||
|
||||
ctl.send_block(cmd="conf-set", section="remote", item="id", data="test")
|
||||
resp = ctl.receive_block()
|
||||
|
||||
try:
|
||||
ctl.send_block(cmd="conf-commit")
|
||||
resp = ctl.receive_block()
|
||||
except libknot.control.KnotCtlError as exc:
|
||||
isset(exc.message == "no remote address defined", "commit error code")
|
||||
else:
|
||||
set_err("UNEXPECTED RETURN")
|
||||
|
||||
ctl.send_block(cmd="conf-set", section="remote", identifier="test", item="address", data="::1")
|
||||
resp = ctl.receive_block()
|
||||
|
||||
ctl.send_block(cmd="conf-commit")
|
||||
resp = ctl.receive_block()
|
||||
|
||||
# Add new zone.
|
||||
ctl.send_block(cmd="conf-begin")
|
||||
resp = ctl.receive_block()
|
||||
|
|
|
|||
Loading…
Reference in a new issue