Giuseppe Lavagetto has uploaded a new change for review. (
https://gerrit.wikimedia.org/r/350823 )
Change subject: scap::dsh::group: add datacenters to scap/conftool config
......................................................................
scap::dsh::group: add datacenters to scap/conftool config
Change-Id: If778a98b6f244f7051098747fb526c72fab9b936
---
M hieradata/common/scap/dsh.yaml
M modules/scap/manifests/dsh/group.pp
M modules/scap/templates/dsh/dsh-group-conftool.tpl.erb
A modules/scap/templates/dsh/dsh_group_keys.erb
4 files changed, 12 insertions(+), 5 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/operations/puppet
refs/changes/23/350823/1
diff --git a/hieradata/common/scap/dsh.yaml b/hieradata/common/scap/dsh.yaml
index fcdd921..c110f17 100644
--- a/hieradata/common/scap/dsh.yaml
+++ b/hieradata/common/scap/dsh.yaml
@@ -60,7 +60,7 @@
- mw1265.eqiad.wmnet
cassandra:
conftool:
- - {'cluster': 'aqs', 'service': 'cassandra'}
+ - {'cluster': 'aqs', 'service': 'cassandra', 'datacenters': ['eqiad']}
- {'cluster': 'maps', 'service': 'cassandra'}
- {'cluster': 'restbase', 'service': 'cassandra'}
hosts:
diff --git a/modules/scap/manifests/dsh/group.pp
b/modules/scap/manifests/dsh/group.pp
index c2d25bb..5dc7d14 100644
--- a/modules/scap/manifests/dsh/group.pp
+++ b/modules/scap/manifests/dsh/group.pp
@@ -16,9 +16,8 @@
if $conftool {
# Usual dirty trick to avoid a parser function.
# TODO: fix this once we have the future parser
- $keys = split(
- inline_template('<%= @conftool.map{|x| ["", x["cluster"],
x["service"]].join "/"}.join("|") %>'),
- '\|')
+ $default_datacenters = ['eqiad', 'codfw']
+ $keys = split(template('scap/dsh/dsh_group_keys.erb'),'\|')
confd::file { "/etc/dsh/group/${title}":
ensure => present,
diff --git a/modules/scap/templates/dsh/dsh-group-conftool.tpl.erb
b/modules/scap/templates/dsh/dsh-group-conftool.tpl.erb
index b4aa72f..96a2259 100644
--- a/modules/scap/templates/dsh/dsh-group-conftool.tpl.erb
+++ b/modules/scap/templates/dsh/dsh-group-conftool.tpl.erb
@@ -9,6 +9,6 @@
# List of hosts gathered from etcd
<%- @keys.each do |key| -%>
# etcd pool: <%= key %>
-{{range $node := ls "<%= key %>/"}}{{ $key := printf "<%= key %>/%s" $node
}}{{ $data := json (getv $key) }}
+{{range $node := ls "<%= key %>/"}}{{ $key := printf "<%= key %>%s" $node }}{{
$data := json (getv $key) }}
{{ if ne $data.pooled "inactive" }}{{ $node }}{{end}}{{end}}
<% end -%>
diff --git a/modules/scap/templates/dsh/dsh_group_keys.erb
b/modules/scap/templates/dsh/dsh_group_keys.erb
new file mode 100644
index 0000000..86df5fa
--- /dev/null
+++ b/modules/scap/templates/dsh/dsh_group_keys.erb
@@ -0,0 +1,8 @@
+<%-
+etcd_keys = []
[email protected] do |x|
+ x['datacenters] ||= @default_datacenters
+ x['datacenters'].each do |dc|
+ etcd_keys << File.join('', dc, x['cluster'], x["service"])
+ end
+end -%><%= etcd_keys.join('|') %>
--
To view, visit https://gerrit.wikimedia.org/r/350823
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: If778a98b6f244f7051098747fb526c72fab9b936
Gerrit-PatchSet: 1
Gerrit-Project: operations/puppet
Gerrit-Branch: production
Gerrit-Owner: Giuseppe Lavagetto <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits