[MediaWiki-commits] [Gerrit] varnish: always generate the dynamic directors lists - change (operations/puppet)

2015-07-01 Thread Giuseppe Lavagetto (Code Review)
Giuseppe Lavagetto has uploaded a new change for review.

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

Change subject: varnish: always generate the dynamic directors lists
..

varnish: always generate the dynamic directors lists

We just don't include them into the varnish configuration if
varnish::dynamic_directors is true. This way, we can control their
generation and correctness across the cluster.

Also: remove spurious inclusion of role::cache::base and fix the
definition of $directors_list for backend instances.

Change-Id: Ic177d31f3661a2adfc2c165e7232314e1e420dac
---
M modules/varnish/manifests/common/directors.pp
M modules/varnish/manifests/instance.pp
M modules/varnish/templates/vcl/wikimedia.vcl.erb
3 files changed, 22 insertions(+), 24 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/operations/puppet 
refs/changes/17/222117/1

diff --git a/modules/varnish/manifests/common/directors.pp 
b/modules/varnish/manifests/common/directors.pp
index 20a72b6..2fad859 100644
--- a/modules/varnish/manifests/common/directors.pp
+++ b/modules/varnish/manifests/common/directors.pp
@@ -14,7 +14,7 @@
 
 $director_list = $instance ? {
 'frontend' = keys($directors),
-'backend'  = $directors[$::mw_primary],
+'backend'  = keys($directors),
 default= undef
 }
 
diff --git a/modules/varnish/manifests/instance.pp 
b/modules/varnish/manifests/instance.pp
index 6886b2e..c7e71bd 100644
--- a/modules/varnish/manifests/instance.pp
+++ b/modules/varnish/manifests/instance.pp
@@ -53,33 +53,31 @@
 }
 
 # Write the dynamic directors configuration, if we need it
-if $dynamic_directors {
-require role::cache::base
-if $name == '' {
-$inst = 'backend'
-} else {
-$inst = $name
-}
+if $name == '' {
+$inst = 'backend'
+} else {
+$inst = $name
+}
 
-if inline_template(%= @directors.map{|k,v| v['dynamic'] 
}.include?('yes') %) == true {
-$use_dynamic_directors = true
-} else {
-$use_dynamic_directors = false
-}
+if inline_template(%= @directors.map{|k,v| v['dynamic'] 
}.include?('yes') %) == true {
+$use_dynamic_directors = true
+} else {
+$use_dynamic_directors = false
+}
 
-if $use_dynamic_directors {
-varnish::common::directors { $vcl:
-instance  = $inst,
-directors = $directors,
-extraopts = $extraopts,
-before= [
-  File[/etc/varnish/wikimedia_${vcl}.vcl],
-  Service[varnish${instancesuffix}]
-  ],
-}
+if $use_dynamic_directors {
+varnish::common::directors { $vcl:
+instance  = $inst,
+directors = $directors,
+extraopts = $extraopts,
+before= [
+  File[/etc/varnish/wikimedia_${vcl}.vcl],
+  Service[varnish${instancesuffix}]
+  ],
 }
 }
 
+
 file { /etc/varnish/wikimedia_${vcl}.vcl:
 owner   = 'root',
 group   = 'root',
diff --git a/modules/varnish/templates/vcl/wikimedia.vcl.erb 
b/modules/varnish/templates/vcl/wikimedia.vcl.erb
index ff72356..859828f 100644
--- a/modules/varnish/templates/vcl/wikimedia.vcl.erb
+++ b/modules/varnish/templates/vcl/wikimedia.vcl.erb
@@ -151,7 +151,7 @@
 # 'backends' = [ backend1, backend2 ],
 # }
 # }
-if @use_dynamic_directors -%
+if @use_dynamic_directors and @dynamic_directors -%
 include directors.%= @inst %.vcl;
 
 % end -%

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ic177d31f3661a2adfc2c165e7232314e1e420dac
Gerrit-PatchSet: 1
Gerrit-Project: operations/puppet
Gerrit-Branch: production
Gerrit-Owner: Giuseppe Lavagetto glavage...@wikimedia.org

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] varnish: always generate the dynamic directors lists - change (operations/puppet)

2015-07-01 Thread Giuseppe Lavagetto (Code Review)
Giuseppe Lavagetto has submitted this change and it was merged.

Change subject: varnish: always generate the dynamic directors lists
..


varnish: always generate the dynamic directors lists

We just don't include them into the varnish configuration if
varnish::dynamic_directors is true. This way, we can control their
generation and correctness across the cluster.

Also: remove spurious inclusion of role::cache::base and fix the
definition of $directors_list for backend instances.

Change-Id: Ic177d31f3661a2adfc2c165e7232314e1e420dac
---
M modules/varnish/manifests/common/directors.pp
M modules/varnish/manifests/instance.pp
M modules/varnish/templates/vcl/wikimedia.vcl.erb
3 files changed, 22 insertions(+), 24 deletions(-)

Approvals:
  Giuseppe Lavagetto: Looks good to me, approved
  BBlack: Looks good to me, but someone else must approve
  jenkins-bot: Verified



diff --git a/modules/varnish/manifests/common/directors.pp 
b/modules/varnish/manifests/common/directors.pp
index 20a72b6..2fad859 100644
--- a/modules/varnish/manifests/common/directors.pp
+++ b/modules/varnish/manifests/common/directors.pp
@@ -14,7 +14,7 @@
 
 $director_list = $instance ? {
 'frontend' = keys($directors),
-'backend'  = $directors[$::mw_primary],
+'backend'  = keys($directors),
 default= undef
 }
 
diff --git a/modules/varnish/manifests/instance.pp 
b/modules/varnish/manifests/instance.pp
index 6886b2e..c7e71bd 100644
--- a/modules/varnish/manifests/instance.pp
+++ b/modules/varnish/manifests/instance.pp
@@ -53,33 +53,31 @@
 }
 
 # Write the dynamic directors configuration, if we need it
-if $dynamic_directors {
-require role::cache::base
-if $name == '' {
-$inst = 'backend'
-} else {
-$inst = $name
-}
+if $name == '' {
+$inst = 'backend'
+} else {
+$inst = $name
+}
 
-if inline_template(%= @directors.map{|k,v| v['dynamic'] 
}.include?('yes') %) == true {
-$use_dynamic_directors = true
-} else {
-$use_dynamic_directors = false
-}
+if inline_template(%= @directors.map{|k,v| v['dynamic'] 
}.include?('yes') %) == true {
+$use_dynamic_directors = true
+} else {
+$use_dynamic_directors = false
+}
 
-if $use_dynamic_directors {
-varnish::common::directors { $vcl:
-instance  = $inst,
-directors = $directors,
-extraopts = $extraopts,
-before= [
-  File[/etc/varnish/wikimedia_${vcl}.vcl],
-  Service[varnish${instancesuffix}]
-  ],
-}
+if $use_dynamic_directors {
+varnish::common::directors { $vcl:
+instance  = $inst,
+directors = $directors,
+extraopts = $extraopts,
+before= [
+  File[/etc/varnish/wikimedia_${vcl}.vcl],
+  Service[varnish${instancesuffix}]
+  ],
 }
 }
 
+
 file { /etc/varnish/wikimedia_${vcl}.vcl:
 owner   = 'root',
 group   = 'root',
diff --git a/modules/varnish/templates/vcl/wikimedia.vcl.erb 
b/modules/varnish/templates/vcl/wikimedia.vcl.erb
index ff72356..859828f 100644
--- a/modules/varnish/templates/vcl/wikimedia.vcl.erb
+++ b/modules/varnish/templates/vcl/wikimedia.vcl.erb
@@ -151,7 +151,7 @@
 # 'backends' = [ backend1, backend2 ],
 # }
 # }
-if @use_dynamic_directors -%
+if @use_dynamic_directors and @dynamic_directors -%
 include directors.%= @inst %.vcl;
 
 % end -%

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

Gerrit-MessageType: merged
Gerrit-Change-Id: Ic177d31f3661a2adfc2c165e7232314e1e420dac
Gerrit-PatchSet: 2
Gerrit-Project: operations/puppet
Gerrit-Branch: production
Gerrit-Owner: Giuseppe Lavagetto glavage...@wikimedia.org
Gerrit-Reviewer: BBlack bbl...@wikimedia.org
Gerrit-Reviewer: Giuseppe Lavagetto glavage...@wikimedia.org
Gerrit-Reviewer: jenkins-bot 

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits