def validate_config(self, organization, config, actor=None):
if config.get('url'):
client = self.get_client(actor)
# parse out the repo name and the instance
parts = urlparse(config['url'])
instance = parts.netloc
name = parts.path.rsplit('_git/', 1)[-1]
project = config.get('project') or name
try:
repo = client.get_repo(instance, name, project)
except Exception as e:
self.raise_error(e, identity=client.auth)
config.update({
'instance': instance,
'project': project,
'name': repo['name'],
'external_id': six.text_type(repo['id']),
'url': repo['_links']['web']['href'],
})
return config
评论列表
文章目录