[Bug 221732] sysutils/consul - check config in rc.d script

bugzilla-noreply at freebsd.org bugzilla-noreply at freebsd.org
Wed Aug 23 03:39:51 UTC 2017


https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=221732

            Bug ID: 221732
           Summary: sysutils/consul - check config in rc.d script
           Product: Ports & Packages
           Version: Latest
          Hardware: Any
                OS: Any
            Status: New
          Severity: Affects Only Me
          Priority: ---
         Component: Individual Port(s)
          Assignee: swills at FreeBSD.org
          Reporter: thompsa at FreeBSD.org
          Assignee: swills at FreeBSD.org
             Flags: maintainer-feedback?(swills at FreeBSD.org)

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"

-- 
You are receiving this mail because:
You are the assignee for the bug.


More information about the freebsd-ports-bugs mailing list