abandon_stale.py: Adapt to removal of digest authentication
HTTP Digest authentication was removed in Gerrit 2.14 and now only basic authentication is supported. Change the default authentication to basic, but still support digest for backwards compatibility with previous Gerrit versions. Change-Id: I7ccf9d2c506ed79f1209f995856c42c4936b4872
This commit is contained in:
@@ -59,7 +59,11 @@ def _main():
|
|||||||
help='gerrit server URL')
|
help='gerrit server URL')
|
||||||
parser.add_option('-b', '--basic-auth', dest='basic_auth',
|
parser.add_option('-b', '--basic-auth', dest='basic_auth',
|
||||||
action='store_true',
|
action='store_true',
|
||||||
help='use HTTP basic authentication instead of digest')
|
help='(deprecated) use HTTP basic authentication instead'
|
||||||
|
' of digest')
|
||||||
|
parser.add_option('-d', '--digest-auth', dest='digest_auth',
|
||||||
|
action='store_true',
|
||||||
|
help='use HTTP digest authentication instead of basic')
|
||||||
parser.add_option('-n', '--dry-run', dest='dry_run',
|
parser.add_option('-n', '--dry-run', dest='dry_run',
|
||||||
action='store_true',
|
action='store_true',
|
||||||
help='enable dry-run mode: show stale changes but do '
|
help='enable dry-run mode: show stale changes but do '
|
||||||
@@ -115,10 +119,10 @@ def _main():
|
|||||||
message = "Abandoning after %s %s or more of inactivity." % \
|
message = "Abandoning after %s %s or more of inactivity." % \
|
||||||
(match.group(1), match.group(2))
|
(match.group(1), match.group(2))
|
||||||
|
|
||||||
if options.basic_auth:
|
if options.digest_auth:
|
||||||
auth_type = HTTPBasicAuthFromNetrc
|
|
||||||
else:
|
|
||||||
auth_type = HTTPDigestAuthFromNetrc
|
auth_type = HTTPDigestAuthFromNetrc
|
||||||
|
else:
|
||||||
|
auth_type = HTTPBasicAuthFromNetrc
|
||||||
|
|
||||||
try:
|
try:
|
||||||
auth = auth_type(url=options.gerrit_url)
|
auth = auth_type(url=options.gerrit_url)
|
||||||
|
Reference in New Issue
Block a user