Consul will silently fail to load if there is a syntax error in the config, add a precheck to catch this. --- /usr/local/etc/rc.d/consul 2017-07-19 10:19:37.000000000 +1200 +++ /tmp/puppet-file20170823-57649-2mf3pd 2017-08-23 15:29:05.985906660 +1200 @@ -22,7 +22,7 @@ name=consul rcvar=consul_enable -extra_commands="reload" +extra_commands="reload configtest" load_rc_config $name @@ -37,6 +37,10 @@ command_args="-f -p ${pidfile} /usr/bin/env ${consul_env} ${procname} agent -data-dir=${consul_dir} -config-dir=/usr/local/etc/consul.d ${consul_args}" start_precmd=consul_startprecmd +restart_precmd=consul_checkconfig +reload_precmd=consul_checkconfig +configtest_cmd=consul_checkconfig +upgrade_precmd=consul_checkconfig consul_startprecmd() { @@ -47,7 +51,12 @@ if [ ! -d ${consul_dir} ]; then install -d -o ${consul_user} -g ${consul_group} ${consul_dir} fi + consul_checkconfig +} +consul_checkconfig() +{ + ${procname} validate /usr/local/etc/consul.d } run_rc_command "$1"
I used nginx as a template, the upgrade_precmd line shouldnt have been copied.
A commit references this bug: Author: swills Date: Sun Sep 17 01:43:07 UTC 2017 New revision: 449980 URL: https://svnweb.freebsd.org/changeset/ports/449980 Log: sysutils/consul: check config in rc.d script PR: 221732 Submitted by: thompsa Changes: head/sysutils/consul/Makefile head/sysutils/consul/files/consul.in
A commit references this bug: Author: swills Date: Sun Sep 17 01:44:09 UTC 2017 New revision: 449981 URL: https://svnweb.freebsd.org/changeset/ports/449981 Log: sysutils/consul: remove unneeded upgrade_precmd line PR: 221732 Pointyhat to: swills Changes: head/sysutils/consul/files/consul.in
Committed, thanks!