keactrl exits with an error without definitions for netconf
Describe the bug
I'm trying Kea 2.0.1 (which is built without kea-netconf). If I try to start Kea servers using keactrl
with the following configuration:
prefix=/home/keadist
kea_dhcp4_config_file=${prefix}/etc/kea/kea-dhcp4.conf
kea_dhcp6_config_file=${prefix}/etc/kea/kea-dhcp6.conf
kea_dhcp_ddns_config_file=${prefix}/etc/kea/kea-dhcp-ddns.conf
kea_ctrl_agent_config_file=${prefix}/etc/kea/kea-ctrl-agent.conf
exec_prefix=${prefix}
dhcp4_srv=${exec_prefix}/sbin/kea-dhcp4
dhcp6_srv=${exec_prefix}/sbin/kea-dhcp6
dhcp_ddns_srv=${exec_prefix}/sbin/kea-dhcp-ddns
ctrl_agent_srv=${exec_prefix}/sbin/kea-ctrl-agent
dhcp4=yes
dhcp6=no
dhcp_ddns=no
ctrl_agent=no
kea_verbose=no
then the servers start up but keactrl exits with a non-0 status:
# /home/keadist/sbin/keactrl start -c $PWD/keactrl.conf && echo OK
/home/keadist/sbin/keactrl: 467: /home/keadist/sbin/keactrl: netconf: parameter not set
INFO/keactrl: Starting /home/keadist/sbin/kea-dhcp4 -c /home/keadist/etc/kea/kea-dhcp4.conf
INFO/keactrl: Starting /home/keadist/sbin/kea-dhcp-ddns -c /home/keadist/etc/kea/kea-dhcp-ddns.conf
/home/keadist/sbin/keactrl: 488: /home/keadist/sbin/keactrl: netconf_srv: parameter not set
(Note that "OK" isn't emitted)
Same for keactrl stop
.
The cause of this looks like the following check:
# Exit with error if commands exit with non-zero and if undefined variables are
# used.
set -eu
and the fact that the keactrl.conf
file doesn't define netconf_srv
. So the execution of keactrl
triggers an error at line 488:
run_conditional "netconf" "start_server ${netconf_srv} -c ${kea_netconf_config_file} \
${args}" 1
(I initially thought the same thing could happen on line 467, but probably because of the use of a pipe it somehow avoids this failure mode).
To Reproduce
See above.
Expected behavior
I would expect keactrl
exits normally (with the exit status of 0) when Kea is built without the support of netconf. One might argue that the configuration should have netconf related definitions, but it doesn't make sense to me if Kea isn't build its support (so netconf_srv
should be set to some placeholder value, which would look awkward). Besides, keactrl
already seems to try avoiding this failure mode in some places, e.g.:
if ${have_netconf}; then
printf "Kea Netconf configuration file: %s\n" "${kea_netconf_config_file}"
fi
Addressing the essentially same glitch in place but not for other places is inconsistent.
Environment:
- Kea version: 2.0.1
- OS: Ubuntu 18.04.4 x64
- Build option:
--disable-static --enable-generate-messages --with-gtest-source
. I don't think it matters for this issue, but I'd note that libyang etc wasn't detected andkea-netconf
wasn't built. - No hook is used (again, though, I don't think it matters)