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

Add support to set status for alert

parent 86259ef3
Branches
No related tags found
No related merge requests found
...@@ -29,6 +29,7 @@ class Alerta: ...@@ -29,6 +29,7 @@ class Alerta:
self.parser.add_argument('apikey', help='Alerta API key') self.parser.add_argument('apikey', help='Alerta API key')
self.parser.add_argument('payload', help='Json string or filename') self.parser.add_argument('payload', help='Json string or filename')
self.parser.add_argument('--pid', help='Project ID') self.parser.add_argument('--pid', help='Project ID')
self.parser.add_argument('--status', help='Alert status')
self.args, self.extras = self.parser.parse_known_args() self.args, self.extras = self.parser.parse_known_args()
if os.path.isfile(self.args.payload): if os.path.isfile(self.args.payload):
...@@ -53,8 +54,10 @@ class Alerta: ...@@ -53,8 +54,10 @@ class Alerta:
'value': '', 'value': '',
'rawData': '', 'rawData': '',
} }
if 'pid' in self.args: if 'pid' in self.args and self.args.pid is not None:
values['attributes'] = {"gitlab_project_id": "%s" % self.args.pid} values['attributes'] = {"gitlab_project_id": "%s" % self.args.pid}
if 'status' in self.args and self.args.pid is not None:
values['status'] = self.args.status
return values return values
@staticmethod @staticmethod
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment