Chad has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/339035 )

Change subject: clean.py: Fix up l10nupdate-owned files on masters
......................................................................

clean.py: Fix up l10nupdate-owned files on masters

Tidy up static types into a clean array for easier maintenance

Change-Id: I9fe572c62971cc9a9b7364fd91d7478f385939c2
---
M scap/plugins/clean.py
1 file changed, 25 insertions(+), 1 deletion(-)


  git pull ssh://gerrit.wikimedia.org:29418/operations/mediawiki-config 
refs/changes/35/339035/1

diff --git a/scap/plugins/clean.py b/scap/plugins/clean.py
index ed49e9c..9aecb6d 100644
--- a/scap/plugins/clean.py
+++ b/scap/plugins/clean.py
@@ -6,6 +6,22 @@
 import scap.main as main
 import scap.ssh as ssh
 
+STATIC_TYPES = [
+    'gif',
+    'jpg',
+    'jpeg',
+    'png',
+    'css',
+    'js',
+    'json',
+    'woff',
+    'woff2',
+    'svg',
+    'eot',
+    'ttf',
+    'ico'
+]
+
 
 @cli.command('clean')
 class Clean(main.AbstractSync):
@@ -16,6 +32,14 @@
                   help='Only keep static assets (CSS/JS and the like).')
     def main(self, *extra_args):
         """ Clean old branches from the cluster for space savings! """
+
+        # Prune junk from masters owned by l10nupdate
+        self.do_stuff(
+            'clean-masters-l10nupdate',
+            self._get_master_list(),
+            ['sudo', '-u', 'l10nupdate', 'find', self.config['stage_dir']
+             '-user', 'l10nupdate', '-delete']
+        )
 
         # Update masters
         self.do_stuff(
@@ -44,7 +68,7 @@
 
     def clean_command(self, location):
         path = os.path.join(location, 'php-%s' % self.arguments.branch)
-        regex = '.*\.(gif|jpe?g|png|css|js|json|woff|woff2|svg|eot|ttf|ico)'
+        regex = '.*\.(%s)' % ('|'.join(STATIC_TYPES))
         if self.arguments.keep_static:
             return ['find', path, '-regextype', 'posix-extended', '-not',
                     '-regex', regex, '-delete']

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I9fe572c62971cc9a9b7364fd91d7478f385939c2
Gerrit-PatchSet: 1
Gerrit-Project: operations/mediawiki-config
Gerrit-Branch: master
Gerrit-Owner: Chad <[email protected]>

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

Reply via email to