Volans has submitted this change and it was merged. ( https://gerrit.wikimedia.org/r/344426 )
Change subject: Use the Remote class everywhere ...................................................................... Use the Remote class everywhere Bug: T160178 Change-Id: Ie86d0974962001dd883679c289f500b3c500e5c4 --- M switchdc/lib/mediawiki.py M switchdc/lib/mysql.py M switchdc/stages/t05_varnish_text_caches.py 3 files changed, 9 insertions(+), 16 deletions(-) Approvals: jenkins-bot: Verified Volans: Looks good to me, approved diff --git a/switchdc/lib/mediawiki.py b/switchdc/lib/mediawiki.py index eb0bf67..4ec4f8e 100644 --- a/switchdc/lib/mediawiki.py +++ b/switchdc/lib/mediawiki.py @@ -2,11 +2,7 @@ import requests -from switchdc import remote, SwitchdcError - - -class MediawikiError(SwitchdcError): - """Custom exception class for errors of this module.""" +from switchdc.lib.remote import Remote def check_config_line(filename, expected): @@ -16,9 +12,9 @@ filename -- filename without extension of wmf-config expected -- string expected to be found in the configuration file """ - noc = remote.Remote() - noc.select('R:Class = Role::Noc::Site') - noc_server = noc.hosts[0] + remote = Remote() + remote.select('R:Class = Role::Noc::Site') + noc_server = remote.hosts[0] try: mwconfig = requests.get('http://{noc}/conf/{filename}.php.txt'.format(noc=noc_server, filename=filename)) except Exception: @@ -34,9 +30,8 @@ filename -- filename without extension of wmf-config message -- the message to use for the scap sync-file execution """ - query = 'R:Class = Deployment::Rsync and R:Class%cron_ensure = absent' + remote = Remote() + remote.select('R:Class = Deployment::Rsync and R:Class%cron_ensure = absent') command = 'su - {user} -c \'scap sync-file wmf-config/{filename}.php "{message}"\''.format( user=os.getlogin(), filename=filename, message=message) - rc, _ = remote.run(query, 'sync', [command]) - if rc != 0: - raise MediawikiError(1) + remote.sync(command) diff --git a/switchdc/lib/mysql.py b/switchdc/lib/mysql.py index 5cbb3cd..13f2a77 100644 --- a/switchdc/lib/mysql.py +++ b/switchdc/lib/mysql.py @@ -1,6 +1,6 @@ from switchdc import SwitchdcError +from switchdc.lib.remote import Remote from switchdc.log import logger -from switchdc.remote import Remote class MysqlError(SwitchdcError): diff --git a/switchdc/stages/t05_varnish_text_caches.py b/switchdc/stages/t05_varnish_text_caches.py index 0dc12ee..275e746 100644 --- a/switchdc/stages/t05_varnish_text_caches.py +++ b/switchdc/stages/t05_varnish_text_caches.py @@ -8,6 +8,4 @@ """Enable Puppet and force a run to get updated config on Varnish text caches.""" remote = Remote() remote.select('R:Class = Role::Cache::Text') - rc = remote.async('puppet agent --enable', puppet.get_agent_run_command(), batch_size=30) - - return rc + remote.async('puppet agent --enable', puppet.get_agent_run_command(), batch_size=30) -- To view, visit https://gerrit.wikimedia.org/r/344426 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: merged Gerrit-Change-Id: Ie86d0974962001dd883679c289f500b3c500e5c4 Gerrit-PatchSet: 2 Gerrit-Project: operations/switchdc Gerrit-Branch: master Gerrit-Owner: Volans <rcocci...@wikimedia.org> Gerrit-Reviewer: Volans <rcocci...@wikimedia.org> Gerrit-Reviewer: jenkins-bot <> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits