Fix enforcing users with (not only) LDAP
diff --git a/_modules/gerrit.py b/_modules/gerrit.py
index 369c2a2..6132ead 100644
--- a/_modules/gerrit.py
+++ b/_modules/gerrit.py
@@ -212,7 +212,7 @@
}
kwargs.update(gerrit.kwargs.copy())
- response = requests.put(gerrit.make_url(path), **kwargs)
+ response = requests.post(gerrit.make_url(path), **kwargs)
def _create_group_membership(gerrit, account_id, group_id):
@@ -367,7 +367,7 @@
output['email'] = email
change |= emails_changed
- if params.get('groups') is not None:
+ if params.get('groups'):
groups, groups_changed = _ensure_only_member_of_these_groups(
gerrit, account_info.get('name'), params['groups'])
output['groups'] = groups
@@ -579,10 +579,9 @@
'''
gerrit_client = _gerrit_http_connection(**kwargs)
- accounts = account_list(**kwargs)
- if(name in accounts):
- ret = accounts.pop(name)
- else:
+ try:
+ ret = gerrit_client.get('/accounts/%s' % name)
+ except Exception:
ret = {'Error': 'Error in retrieving account'}
return ret
diff --git a/gerrit/files/_gerrit.conf b/gerrit/files/_gerrit.conf
index 4cbbec5..68764b5 100644
--- a/gerrit/files/_gerrit.conf
+++ b/gerrit/files/_gerrit.conf
@@ -2,7 +2,7 @@
gerrit:
host: {{ client.server.host }}
user: {{ client.server.user }}
- auth_method: {{ client.server.get('auth_method', 'digest')
+ auth_method: {{ client.server.get('auth_method', 'digest') }}
{%- if client.server.protocol is defined %}
protocol: {{ client.server.protocol }}
{%- endif %}