Support more auth methods in gerrit module
diff --git a/_modules/gerrit.py b/_modules/gerrit.py
index bd21b2e..369c2a2 100644
--- a/_modules/gerrit.py
+++ b/_modules/gerrit.py
@@ -457,11 +457,16 @@
protocol = get('protocol', 'http')
username = get('user', 'admin')
password = get('password', 'admin')
+ auth_method = get('auth_method', 'digest')
url = protocol+"://"+str(host)+':'+str(http_port)
- auth = requests.auth.HTTPDigestAuth(
- username, password)
+ if auth_method == 'digest':
+ auth = requests.auth.HTTPDigestAuth(username, password)
+ elif auth_method == 'basic':
+ auth = requests.auth.HTTPBasicAuth(username, password)
+ else:
+ raise Exception("Unknown auth_method %s" % auth_method)
gerrit = pygerrit.rest.GerritRestAPI(
url=url, auth=auth)