add configtest action to init.d script

Bug #1284095 reported by Samuele Giovanni Tonon
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
varnish (Debian)
Fix Released
Unknown
varnish (Ubuntu)
Fix Released
Undecided
Mattia Rizzolo

Bug Description

hello,
it would be awesome to have a configtest action in the init.d script ,
in this way you can safely test a vcl configuration by just doing

/etc/init.d/varnish configtest

this can be done by applying this simple patch to /etc/init.d/varnish
--- /etc/init.d/varnish.old 2013-06-29 16:21:10.000000000 +0200
+++ /etc/init.d/varnish 2014-02-24 14:00:34.342417000 +0100
@@ -89,6 +89,10 @@
     exit $?
 }

+configtest() {
+ $DAEMON ${DAEMON_OPTS} -C -n /tmp > /dev/null && echo "Syntax ok"
+}
+
 case "$1" in
     start)
         case "${START:-}" in
@@ -113,8 +117,11 @@
         $0 stop
         $0 start
         ;;
+ configtest)
+ configtest
+ ;;
     *)
- log_success_msg "Usage: $0 {start|stop|restart|reload|force-reload}"
+ log_success_msg "Usage: $0 {start|stop|restart|reload|force-reload|configtest}"
         exit 1
         ;;
 esac

Cheers
Samuele

Changed in varnish (Debian):
status: Unknown → New
Mattia Rizzolo (mapreri)
Changed in varnish (Ubuntu):
assignee: nobody → Mattia Rizzolo (mapreri)
status: New → In Progress
Revision history for this message
Mattia Rizzolo (mapreri) wrote :

committed together the fix for the bug #1285299.

Changed in varnish (Ubuntu):
status: In Progress → Fix Committed
Revision history for this message
Stig Sandbeck Mathisen (ssm) wrote : Re: [Bug 1284095] [NEW] add configtest action to init.d script

On Mon, Feb 24, 2014 at 01:02:41PM -0000, Samuele Giovanni Tonon wrote:
> Public bug reported:
>
> hello, it would be awesome to have a configtest action in the init.d
> script , in this way you can safely test a vcl configuration by just
> doing
>
> /etc/init.d/varnish configtest

Thank you.

Automatic testing of the configuration with this before starting the
service is a very good feature. I'm less convinced it should replace
"varnishadm" for interactive use, though.

--
Stig

Revision history for this message
Samuele Giovanni Tonon (samu-linuxasylum) wrote :

On 03/02/2014 04:34 PM, Stig Sandbeck Mathisen wrote:
> On Mon, Feb 24, 2014 at 01:02:41PM -0000, Samuele Giovanni Tonon wrote:
>> Public bug reported:
>>
>> hello, it would be awesome to have a configtest action in the init.d
>> script , in this way you can safely test a vcl configuration by just
>> doing
>>
>> /etc/init.d/varnish configtest
>
> Thank you.
>
> Automatic testing of the configuration with this before starting the
> service is a very good feature. I'm less convinced it should replace
> "varnishadm" for interactive use, though.
>
i think they are two totally different scenarios.

i'd use "-C" or configtest just as a syntax check, the same way
apachectl configtest or nginx -t -c /etc/nginx/nginx.conf .

varnishadm is for a hot swap of the conf without having to restart
and loose my cache. i'd use varnishadm *AFTER* configtest

Cheers
Samuele

Revision history for this message
Stig Sandbeck Mathisen (ssm) wrote :

Samuele Giovanni Tonon <email address hidden> writes:

> i think they are two totally different scenarios.
>
> i'd use "-C" or configtest just as a syntax check, the same way
> apachectl configtest or nginx -t -c /etc/nginx/nginx.conf .

Actually, good point.

I've been using "varnishadm vcl.load" instead of "-C". It does check the
config, but I guess that only works if you have a running varnish.

--
Stig Sandbeck Mathisen

Changed in varnish (Debian):
status: New → Fix Committed
Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package varnish - 3.0.5-1ubuntu2

---------------
varnish (3.0.5-1ubuntu2) trusty; urgency=medium

  * Add missing "needs-root" test restriction.
 -- Martin Pitt <email address hidden> Mon, 24 Mar 2014 18:13:21 +0100

Changed in varnish (Ubuntu):
status: Fix Committed → Fix Released
Changed in varnish (Debian):
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.