gitlab.lister: Do not expect gitlab instances to have credentials

Only the main gitlab.com instance supports a rate limit (thus the
credentials need), others do not (as per summer 2018).
This commit is contained in:
Antoine R. Dumont (@ardumont) 2018-10-05 11:45:42 +02:00
parent f72f2bc6ac
commit ae514a84c4
No known key found for this signature in database
GPG key ID: 52E2E9840D10C3B8

View file

@ -59,11 +59,9 @@ class GitLabLister(PageByPageHttpLister):
params = {
'headers': self.request_headers() or {}
}
# Retrieve the credentials per instance
creds = self.config['credentials']
if creds:
creds_lister = creds[self.instance]
auth = random.choice(creds_lister) if creds else None
creds_lister = self.config['credentials'].get(self.instance)
if creds_lister:
auth = random.choice(creds_lister)
if auth:
params['auth'] = (auth['username'], auth['password'])
return params