Chad has uploaded a new change for review. ( https://gerrit.wikimedia.org/r/363970 )
Change subject: WIP: Simple wrapper around updating the interwiki cache ...................................................................... WIP: Simple wrapper around updating the interwiki cache Change-Id: I4a709e8379f7054b1a21a8aff0487403f661b055 --- A scap/plugins/updateinterwikicache.py 1 file changed, 51 insertions(+), 0 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/operations/mediawiki-config refs/changes/70/363970/1 diff --git a/scap/plugins/updateinterwikicache.py b/scap/plugins/updateinterwikicache.py new file mode 100644 index 0000000..29170f6 --- /dev/null +++ b/scap/plugins/updateinterwikicache.py @@ -0,0 +1,51 @@ +# -*- coding: utf-8 -*- +""" + scap.plugins.updateinterwikicache + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + For updating + syncing the interwiki cache +""" +import os +import subprocess + +import scap.cli as cli +import scap.main as main +import scap.tasks as tasks +import scap.utils as utils + + [email protected]('update-interwiki-cache') +class UpdateInterwikiCache(main.SyncFile): + """ Scap sub-command to update and sync the interwiki cache """ + + def main(self, *extra_args): + """ Update the latest interwiki cache! """ + self.arguments.message = 'Updating interwiki cache' + return super(UpdateInterwikiCache, self).main(*extra_args) + + def _before_cluster_sync(self): + interwikifile = os.path.join(self.config['stage_dir'], 'wmf-config', + 'interwiki.php') + self.include = os.path.relpath(interwikifile, self.config['stage_dir']) + + with open(interwikifile) as outfile: + subprocess.check_call( + ['/usr/local/bin/mwscript', + 'extensions/WikimediaMaintenance/dumpInterwiki.php'], + stdout=outfile + ) + + # This shouldn't happen, but let's be safe + tasks.check_valid_syntax(interwikifile) + + subprocess.check_call(['/usr/bin/git', 'commit', '-q', '-m', + self.arguments.message, self.arguments.include]) + + subprocess.check_call(['/usr/bin/git', 'push', '-q', 'origin', + 'HEAD:refs/for/master%l=Code-Review+2']) + + if not utils.confirm('Has Jenkins merged your gerrit change yet?'): + subprocess.check_call(['/usr/bin/git', 'reset', '--hard', + 'origin/master']) + raise RuntimeError('Aborting, you should not sync unmerged code') + + subprocess.check_call('/usr/bin/git', 'pull') -- To view, visit https://gerrit.wikimedia.org/r/363970 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I4a709e8379f7054b1a21a8aff0487403f661b055 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
