Mark Bergsma has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/66124


Change subject: Awful hacks to make Puppet work are nothing new...
......................................................................

Awful hacks to make Puppet work are nothing new...

Change-Id: Iffd21658576c77b731b53a9139a8de2fe541fe38
---
M manifests/varnish.pp
1 file changed, 13 insertions(+), 7 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/operations/puppet 
refs/changes/24/66124/1

diff --git a/manifests/varnish.pp b/manifests/varnish.pp
index ff4961a..7e09fbe 100644
--- a/manifests/varnish.pp
+++ b/manifests/varnish.pp
@@ -53,11 +53,14 @@
                }
        }
 
-       define extra-vcl($instancesuffix) {
-               file { "/etc/varnish/${title}.inc.vcl":
-                       content => template("varnish/${title}.inc.vcl.erb"),
-                       notify => Exec["load-new-vcl-file${instancesuffix}"],
-                       mode => 0444;
+       define extra-vcl {
+               $vcl = split($title, '/')[0]
+               $filename = "/etc/varnish/${vcl}.inc.vcl"
+               if !defined(File[$filename]) {
+                       file { $filename:
+                               content => 
template("varnish/${vcl}.inc.vcl.erb"),
+                               mode => 0444;
+                       }
                }
        }
 
@@ -104,7 +107,7 @@
                # Install VCL include files shared by all instances
                require "varnish::common-vcl"
 
-               extra-vcl { $extra_vcl: instancesuffix => $instancesuffix }
+               extra-vcl{ suffix($extra_vcl, "/${instancesuffix}"):}
 
                file {
                        "/etc/init.d/varnish${instancesuffix}":
@@ -141,7 +144,10 @@
 
                exec { "load-new-vcl-file${instancesuffix}":
                        require => [ Service["varnish${instancesuffix}"], 
File["/etc/varnish/wikimedia_${vcl}.vcl"] ],
-                       subscribe => 
[File["/etc/varnish/wikimedia_${vcl}.vcl"], Class["varnish::common-vcl"]],
+                       subscribe => [File["/etc/varnish/wikimedia_${vcl}.vcl"],
+                               Class["varnish::common-vcl"],
+                               File[suffix(prefix($extra_vcl, 
"/etc/varnish/"), ".inc.vcl")]
+                               ],
                        command => "/usr/share/varnish/reload-vcl $extraopts",
                        path => "/bin:/usr/bin",
                        refreshonly => true;

-- 
To view, visit https://gerrit.wikimedia.org/r/66124
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Iffd21658576c77b731b53a9139a8de2fe541fe38
Gerrit-PatchSet: 1
Gerrit-Project: operations/puppet
Gerrit-Branch: production
Gerrit-Owner: Mark Bergsma <[email protected]>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to