Mark Bergsma has submitted this change and it was merged.
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, 14 insertions(+), 7 deletions(-)
Approvals:
Mark Bergsma: Verified; Looks good to me, approved
diff --git a/manifests/varnish.pp b/manifests/varnish.pp
index ff4961a..6c3fd69 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 = regsubst($title, '^([^/]+)/', '\1')
+ $filename = "/etc/varnish/${vcl}.inc.vcl"
+ if !defined(File[$filename]) {
+ file { $filename:
+ content =>
template("varnish/${vcl}.inc.vcl.erb"),
+ mode => 0444;
+ }
}
}
@@ -104,7 +107,8 @@
# Install VCL include files shared by all instances
require "varnish::common-vcl"
- extra-vcl { $extra_vcl: instancesuffix => $instancesuffix }
+ $extra_vcl_variable_to_make_puppet_parser_happy =
suffix($extra_vcl, "/${instancesuffix}")
+ extra-vcl{ $extra_vcl_variable_to_make_puppet_parser_happy: }
file {
"/etc/init.d/varnish${instancesuffix}":
@@ -141,7 +145,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: merged
Gerrit-Change-Id: Iffd21658576c77b731b53a9139a8de2fe541fe38
Gerrit-PatchSet: 4
Gerrit-Project: operations/puppet
Gerrit-Branch: production
Gerrit-Owner: Mark Bergsma <[email protected]>
Gerrit-Reviewer: Mark Bergsma <[email protected]>
Gerrit-Reviewer: jenkins-bot
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits