Minor fixes of gerrit module
Change-Id: I86942d70c5562519a96d9eb8c575813f9f50fb5c
diff --git a/_modules/gerrit.py b/_modules/gerrit.py
index 6132ead..8a23a01 100644
--- a/_modules/gerrit.py
+++ b/_modules/gerrit.py
@@ -212,14 +212,12 @@
}
kwargs.update(gerrit.kwargs.copy())
- response = requests.post(gerrit.make_url(path), **kwargs)
+ requests.post(gerrit.make_url(path), **kwargs)
def _create_group_membership(gerrit, account_id, group_id):
logging.info('Creating membership of %s in group %s', account_id, group_id)
# group_id = _group_name2id(gerrit, group_id)
- print group_id
- import json
path = 'groups/%s/members/%s' % (_quote(group_id), account_id)
gerrit.put(path, data=json.dumps({}))
@@ -384,7 +382,7 @@
if params.get('ssh_key') is not None:
ssh_key, ssh_keys_changed = _ensure_only_one_account_ssh_key(
- gerrit, account_id, params['ssh_key'])
+ gerrit, account_id, params['ssh_key'])
output['ssh_key'] = ssh_key
change |= ssh_keys_changed
@@ -459,7 +457,7 @@
password = get('password', 'admin')
auth_method = get('auth_method', 'digest')
- url = protocol+"://"+str(host)+':'+str(http_port)
+ url = protocol + "://" + str(host) + ':' + str(http_port)
if auth_method == 'digest':
auth = requests.auth.HTTPDigestAuth(username, password)
@@ -548,6 +546,7 @@
})
return output
+
def account_list(**kwargs):
'''
List gerrit accounts
@@ -653,16 +652,15 @@
salt '*' gerrit.project_create namespace/nova description='nova project'
'''
- ret = {}
gerrit_client = _gerrit_ssh_connection(**kwargs)
project = project_get(name, **kwargs)
- if project and not "Error" in project:
+ if project and "Error" not in project:
LOG.debug("Project {0} exists".format(name))
return project
- new = gerrit_client.createProject(name)
+ gerrit_client.createProject(name)
return project_get(name, **kwargs)
@@ -679,7 +677,7 @@
gerrit_client = _gerrit_ssh_connection(**kwargs)
ret = {}
projects = gerrit_client.listProjects()
- if not name in projects:
+ if name not in projects:
return {'Error': 'Error in retrieving project'}
ret[name] = {'name': name}
return ret