jenkins-bot has submitted this change and it was merged. ( 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, 52 insertions(+), 0 deletions(-) Approvals: Chad: Looks good to me, approved jenkins-bot: Verified diff --git a/scap/plugins/updateinterwikicache.py b/scap/plugins/updateinterwikicache.py new file mode 100644 index 0000000..ef428c0 --- /dev/null +++ b/scap/plugins/updateinterwikicache.py @@ -0,0 +1,52 @@ +# -*- 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 + + +@cli.command('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, 'w') 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', 'add', interwikifile]) + subprocess.check_call(['/usr/bin/git', 'commit', '-q', '-m', + self.arguments.message]) + + 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', '-q']) -- To view, visit https://gerrit.wikimedia.org/r/363970 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: merged Gerrit-Change-Id: I4a709e8379f7054b1a21a8aff0487403f661b055 Gerrit-PatchSet: 6 Gerrit-Project: operations/mediawiki-config Gerrit-Branch: master Gerrit-Owner: Chad <ch...@wikimedia.org> Gerrit-Reviewer: Chad <ch...@wikimedia.org> Gerrit-Reviewer: Legoktm <lego...@member.fsf.org> Gerrit-Reviewer: Thcipriani <tcipri...@wikimedia.org> Gerrit-Reviewer: jenkins-bot <> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits