EBernhardson has uploaded a new change for review.
https://gerrit.wikimedia.org/r/232193
Change subject: Fix mwgrep to work without dynamic scripting
......................................................................
Fix mwgrep to work without dynamic scripting
When we turn dynamic scripting off the current implementation
of mwgrep will stop working. This patch moves the script portion
onto the elasticsearch servers so it is no longer a dynamic
script.
Bug: T108151
Change-Id: Idd197ba25ef6e46755413c48dcc82de861bbd613
---
M manifests/role/elasticsearch.pp
M modules/scap/files/mwgrep
2 files changed, 21 insertions(+), 1 deletion(-)
git pull ssh://gerrit.wikimedia.org:29418/operations/puppet
refs/changes/93/232193/1
diff --git a/manifests/role/elasticsearch.pp b/manifests/role/elasticsearch.pp
index 3c97692..2f3f3f0 100644
--- a/manifests/role/elasticsearch.pp
+++ b/manifests/role/elasticsearch.pp
@@ -47,4 +47,20 @@
include ::elasticsearch::log::hot_threads
include ::elasticsearch::nagios::check
+
+ file { '/etc/elasticsearch/scripts':
+ ensure => directory,
+ owner => 'root',
+ group => 'root',
+ mode => '0755',
+ require => File['/etc/elasticsearch'],
+ }
+ file { '/etc/elasticsearch/scripts/mwgrep.groovy':
+ ensure => file,
+ owner => 'root',
+ group => 'root',
+ content => '_source["text"].contains(query)'
+ mode => '0444',
+ require => Package['elasticsearch'],
+ }
}
diff --git a/modules/scap/files/mwgrep b/modules/scap/files/mwgrep
index 521e25d..c49784a 100755
--- a/modules/scap/files/mwgrep
+++ b/modules/scap/files/mwgrep
@@ -88,7 +88,11 @@
filters = [
{'term': {'namespace': str(args.ns)}},
- {'script': {'script': "_source['text'].contains('%s')" %
args.term.replace("'", "\\'")}},
+ {'script': {
+ 'file': 'mwgrep',
+ 'lang': 'groovy',
+ 'params': { 'query': args.term }
+ }},
]
if args.ns == NS_USER or args.ns == NS_MEDIAWIKI:
--
To view, visit https://gerrit.wikimedia.org/r/232193
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Idd197ba25ef6e46755413c48dcc82de861bbd613
Gerrit-PatchSet: 1
Gerrit-Project: operations/puppet
Gerrit-Branch: production
Gerrit-Owner: EBernhardson <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits