jenkins-bot has submitted this change and it was merged. (
https://gerrit.wikimedia.org/r/405056 )
Change subject: branch.py: Fix data payload for REST call, also add .netrc
fallback
......................................................................
branch.py: Fix data payload for REST call, also add .netrc fallback
Change-Id: Ib1b04ab4eeb8be41bc9fb84c8969a241e991c79a
---
M make-release/branch.py
1 file changed, 8 insertions(+), 4 deletions(-)
Approvals:
Paladox: Looks good to me, but someone else must approve
Chad: Looks good to me, approved
jenkins-bot: Verified
diff --git a/make-release/branch.py b/make-release/branch.py
index 71fab5a..015feb8 100755
--- a/make-release/branch.py
+++ b/make-release/branch.py
@@ -18,6 +18,7 @@
import yaml
from pygerrit2.rest import GerritRestAPI
+from pygerrit2.rest.auth import HTTPBasicAuthFromNetrc
# Setup config with local overrides
with open('settings.yaml') as globalconf:
@@ -31,9 +32,12 @@
def _get_client():
"""Get the client for making requests."""
- return GerritRestAPI(
- url=CONFIG['base_url'],
- auth=HTTPBasicAuth(CONFIG['username'], CONFIG['password']))
+ try:
+ auth = HTTPBasicAuth(CONFIG['username'], CONFIG['password'])
+ except KeyError:
+ # Username and password weren't provided, try falling back to .netrc
+ auth = HTTPBasicAuthFromNetrc(CONFIG['base_url'])
+ return GerritRestAPI(url=CONFIG['base_url'], auth=auth)
def get_branchpoint(branch, repository, default):
@@ -64,7 +68,7 @@
'/projects/%s/branches/%s' % (
repository.replace('/', '%2F'),
branch.replace('/', '%2F')),
- data='{"revision":"%s"}' % revision
+ data={'revision': revision}
)
except HTTPError as httpe:
# Gerrit responds 409 for edit conflicts
--
To view, visit https://gerrit.wikimedia.org/r/405056
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: Ib1b04ab4eeb8be41bc9fb84c8969a241e991c79a
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/tools/release
Gerrit-Branch: master
Gerrit-Owner: Chad <[email protected]>
Gerrit-Reviewer: Chad <[email protected]>
Gerrit-Reviewer: Paladox <[email protected]>
Gerrit-Reviewer: jenkins-bot <>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits