[MediaWiki-commits] [Gerrit] operations...debdeploy[master]: Switch to Python3-compatible print()
Muehlenhoff has submitted this change and it was merged. ( https://gerrit.wikimedia.org/r/374950 ) Change subject: Switch to Python3-compatible print() .. Switch to Python3-compatible print() Change-Id: If5cc41ddf765a927c2f40419556fe25d2ff26a0d --- M clients/debdeploy-deploy M clients/debdeploy-restarts M clients/debdeploy-revdeps M server/debdeploy M server/debdeploy_conf.py M server/debdeploy_updatespec.py M server/generate-debdeploy-spec 7 files changed, 95 insertions(+), 83 deletions(-) Approvals: Muehlenhoff: Looks good to me, approved jenkins-bot: Verified Volans: Looks good to me, but someone else must approve diff --git a/clients/debdeploy-deploy b/clients/debdeploy-deploy index d86d3e7..93941fb 100755 --- a/clients/debdeploy-deploy +++ b/clients/debdeploy-deploy @@ -2,6 +2,8 @@ # -*- coding: utf-8 -*- """Module for deploying DEB packages on wide scale.""" +from __future__ import print_function + import argparse import json import logging diff --git a/clients/debdeploy-restarts b/clients/debdeploy-restarts index 184bca9..c697bc4 100755 --- a/clients/debdeploy-restarts +++ b/clients/debdeploy-restarts @@ -4,6 +4,8 @@ Module for listing necessary service restarts after library updates ''' +from __future__ import print_function + import logging import pickle import subprocess @@ -138,7 +140,7 @@ if __name__ == '__main__': -print main() +print(main()) # Local variables: # mode: python diff --git a/clients/debdeploy-revdeps b/clients/debdeploy-revdeps index 3878269..5a9bccc 100755 --- a/clients/debdeploy-revdeps +++ b/clients/debdeploy-revdeps @@ -4,6 +4,8 @@ Module for querying installed reverse dependencies of a package ''' +from __future__ import print_function + import argparse import json import subprocess @@ -48,7 +50,7 @@ if e.output.startswith('E: No packages found'): return result(False, 'INVALID_PACKAGE', []) -print 'Failed to query reverse dependies', e.returncode +print('Failed to query reverse dependies', e.returncode) return result(False, 'QUERY_FAIL', []) deps = set() @@ -67,7 +69,7 @@ if __name__ == '__main__': -print main() +print(main()) # Local variables: # mode: python diff --git a/server/debdeploy b/server/debdeploy index 5b23740..51056f5 100755 --- a/server/debdeploy +++ b/server/debdeploy @@ -5,6 +5,8 @@ # reinstate rollback handling # revamp and readd restart handling +from __future__ import print_function + import argparse import code import cumin @@ -25,7 +27,7 @@ from debdeploy_updatespec import * if os.geteuid() != 0: -print "debdeploy needs to be run as root" +print("debdeploy needs to be run as root") sys.exit(1) @@ -60,7 +62,7 @@ if self.buf.count("\n") > self.threshold: pydoc.pager(self.buf) else: -print self.buf +print(self.buf) def show_unreachable_hosts(worker): @@ -70,10 +72,9 @@ unreachable_hosts.append(node.name) if unreachable_hosts: -print -print "The following hosts were unreachable:" +print("\nThe following hosts were unreachable:") for host in unreachable_hosts: -print host +print(host) def run_cumin(cmd, alias): ''' @@ -103,8 +104,8 @@ return worker except cumin.backends.InvalidQueryError as e: -print "Invalid query:" -print e +print("Invalid query:") +print(e) sys.exit(1) finally: sys.stdout = oldstdout @@ -127,9 +128,9 @@ update_desc["daemon-disrupt"] = "Daemon update with service availability impact" update_desc["library"] = "Library update, several services might need to be restarted" -print "Rolling out", source, ":", -print update_desc[update_type] -print +print("Rolling out", source, ": ") +print(update_desc[update_type]) +print() cmd = '/usr/bin/debdeploy-deploy --source ' + source + ' --updatespec ' for distro in fixes: @@ -150,30 +151,30 @@ "INVALID_DISTRO": "Found an unsupported distro:"} if result['status'] in status_codes: -print status_codes[result['status']] -print status_print.fill(str(nodeset)) -print +print(status_codes[result['status']]) +print(status_print.fill(str(nodeset))) +print() elif result['success'] and result['status'] == 'UPDATES': updates = result['data'] for package in updates.keys(): -print package, "was updated: ", updates[package][0], "->", updates[package][1] -print status_print.fill(str(nodeset)) -print +print(package, "was updated: ",
[MediaWiki-commits] [Gerrit] operations...debdeploy[master]: Switch to Python3-compatible print()
Muehlenhoff has uploaded a new change for review. ( https://gerrit.wikimedia.org/r/374950 ) Change subject: Switch to Python3-compatible print() .. Switch to Python3-compatible print() Change-Id: If5cc41ddf765a927c2f40419556fe25d2ff26a0d --- M clients/debdeploy-deploy M clients/debdeploy-restarts M clients/debdeploy-revdeps M server/debdeploy M server/debdeploy_conf.py M server/debdeploy_updatespec.py M server/generate-debdeploy-spec 7 files changed, 97 insertions(+), 83 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/operations/debs/debdeploy refs/changes/50/374950/1 diff --git a/clients/debdeploy-deploy b/clients/debdeploy-deploy index d86d3e7..68b736e 100755 --- a/clients/debdeploy-deploy +++ b/clients/debdeploy-deploy @@ -2,6 +2,8 @@ # -*- coding: utf-8 -*- """Module for deploying DEB packages on wide scale.""" +from __future__ import print_function + import argparse import json import logging @@ -261,7 +263,7 @@ if __name__ == '__main__': -print(main()) +print((main())) # Local variables: # mode: python diff --git a/clients/debdeploy-restarts b/clients/debdeploy-restarts index 184bca9..c697bc4 100755 --- a/clients/debdeploy-restarts +++ b/clients/debdeploy-restarts @@ -4,6 +4,8 @@ Module for listing necessary service restarts after library updates ''' +from __future__ import print_function + import logging import pickle import subprocess @@ -138,7 +140,7 @@ if __name__ == '__main__': -print main() +print(main()) # Local variables: # mode: python diff --git a/clients/debdeploy-revdeps b/clients/debdeploy-revdeps index 3878269..5a9bccc 100755 --- a/clients/debdeploy-revdeps +++ b/clients/debdeploy-revdeps @@ -4,6 +4,8 @@ Module for querying installed reverse dependencies of a package ''' +from __future__ import print_function + import argparse import json import subprocess @@ -48,7 +50,7 @@ if e.output.startswith('E: No packages found'): return result(False, 'INVALID_PACKAGE', []) -print 'Failed to query reverse dependies', e.returncode +print('Failed to query reverse dependies', e.returncode) return result(False, 'QUERY_FAIL', []) deps = set() @@ -67,7 +69,7 @@ if __name__ == '__main__': -print main() +print(main()) # Local variables: # mode: python diff --git a/server/debdeploy b/server/debdeploy index 5b23740..9100048 100755 --- a/server/debdeploy +++ b/server/debdeploy @@ -5,6 +5,8 @@ # reinstate rollback handling # revamp and readd restart handling +from __future__ import print_function + import argparse import code import cumin @@ -25,7 +27,7 @@ from debdeploy_updatespec import * if os.geteuid() != 0: -print "debdeploy needs to be run as root" +print("debdeploy needs to be run as root") sys.exit(1) @@ -60,7 +62,7 @@ if self.buf.count("\n") > self.threshold: pydoc.pager(self.buf) else: -print self.buf +print(self.buf) def show_unreachable_hosts(worker): @@ -70,10 +72,10 @@ unreachable_hosts.append(node.name) if unreachable_hosts: -print -print "The following hosts were unreachable:" +print() +print("The following hosts were unreachable:") for host in unreachable_hosts: -print host +print(host) def run_cumin(cmd, alias): ''' @@ -103,8 +105,8 @@ return worker except cumin.backends.InvalidQueryError as e: -print "Invalid query:" -print e +print("Invalid query:") +print(e) sys.exit(1) finally: sys.stdout = oldstdout @@ -127,9 +129,9 @@ update_desc["daemon-disrupt"] = "Daemon update with service availability impact" update_desc["library"] = "Library update, several services might need to be restarted" -print "Rolling out", source, ":", -print update_desc[update_type] -print +print("Rolling out", source, ": ") +print(update_desc[update_type]) +print() cmd = '/usr/bin/debdeploy-deploy --source ' + source + ' --updatespec ' for distro in fixes: @@ -150,30 +152,30 @@ "INVALID_DISTRO": "Found an unsupported distro:"} if result['status'] in status_codes: -print status_codes[result['status']] -print status_print.fill(str(nodeset)) -print +print(status_codes[result['status']]) +print(status_print.fill(str(nodeset))) +print() elif result['success'] and result['status'] == 'UPDATES': updates = result['data'] for package in updates.keys(): -print package, "was updated: ", updates[package][0], "->", updates[package][1] -print