Package: varnish
Version: 4.0.2-1
Severity: wishlist
Tags: patch

Hi,

The very nice varnish reload script currently does not clean up old vcl
on reload.  I think the attached patch does this, and would be pleased
if you included it (or something like it) in the package.

I used nmudiff to give you a reasonably clean diff, but I am not
planning to NMU this.  If you see any references to an impending NMU, my
apologies.

Cheers,
-- 
 -----------------------------------------------------------------
|   ,''`.                                            Stephen Gran |
|  : :' :                                        sg...@debian.org |
|  `. `'                        Debian user, admin, and developer |
|    `-                                     http://www.debian.org |
 -----------------------------------------------------------------
diff -Nru varnish-4.0.2/debian/reload-vcl varnish-4.0.2/debian/reload-vcl
--- varnish-4.0.2/debian/reload-vcl	2014-10-14 21:54:12.000000000 +0100
+++ varnish-4.0.2/debian/reload-vcl	2016-01-06 23:33:45.000000000 +0000
@@ -157,13 +157,25 @@
 	    exitstatus=1
 	fi
     fi
+    if [ -n "${VCL_KEEP}" ]
+    then
+        for vcl in $(varnishadm vcl.list | awk '/^available/ { print $3 }' | head -n -1 | tac | tail -n +${VCL_KEEP})
+        do
+            if $varnishadm -T $mgmt_interface -S ${secret} vcl.discard ${vcl}
+            then
+                printf "$vcl_discard_failed" $vcl
+            else
+                printf "$vcl_discard_succeeded" $vcl
+            fi
+        done
+    fi
 else
     printf "$msg_compile_failed" $vcl_label $vcl_file
     exitstatus=1
 fi > $logfile
 
 # Blather
-if [ -z "${quiet}" -o -n "$exitstatus" ]
+if [ -n "$exitstatus" -o -z "${quiet}" ]
 then
     grep -v '^$' >&2 $logfile
 fi
diff -Nru varnish-4.0.2/debian/varnish.default varnish-4.0.2/debian/varnish.default
--- varnish-4.0.2/debian/varnish.default	2014-10-14 21:54:12.000000000 +0100
+++ varnish-4.0.2/debian/varnish.default	2016-01-06 23:24:34.000000000 +0000
@@ -18,6 +18,9 @@
 # you need to increase this number as well
 MEMLOCK=82000
 
+# How many vcl versions to retain on reload
+VCL_KEEP=5
+
 # Default varnish instance name is the local nodename.  Can be overridden with
 # the -n switch, to have more instances on a single server.
 # You may need to uncomment this variable for alternatives 1 and 3 below.

Attachment: signature.asc
Description: Digital signature

Reply via email to