Skip to content
Snippets Groups Projects
Commit 9dde0ac5 authored by jurgenhaas's avatar jurgenhaas
Browse files

Improve project detection

parent e66bc294
No related branches found
No related tags found
No related merge requests found
......@@ -41,14 +41,14 @@ class GitlabIssue(PluginBase):
project = git.projects.get(
alert.attributes['gitlab_project_id'])
else:
origin = alert.origin.split('/').pop()
project = git.projects.get(
'ansible-inventories/hosts/{}/{}'.format(alert.environment,
origin))
if not project:
projects = git.projects.list(search=origin)
if projects:
project = projects[0]
projects = git.projects.list(search=alert.resource)
if projects:
project = projects[0]
else:
project = git.projects.get(
'ansible-inventories/hosts/{}/{}'.format(
alert.environment,
alert.origin.split('/').pop()))
if project:
LOG.info('Project ID %s' % project.id)
......
from setuptools import find_packages, setup
version = '1.3.0'
version = '1.3.1'
setup(
name='alerta-gitlab',
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment