mirror of
https://github.com/valitydev/Cortex-Analyzers.git
synced 2024-11-06 17:15:21 +00:00
Add capacity to add a custom field containing the craeted issue number
This commit is contained in:
parent
d4c79fcb36
commit
d366b6057d
@ -6,7 +6,8 @@
|
|||||||
"license": "AGPL-V3",
|
"license": "AGPL-V3",
|
||||||
"description": "Create a redmine issue from a case",
|
"description": "Create a redmine issue from a case",
|
||||||
"dataTypeList": [
|
"dataTypeList": [
|
||||||
"thehive:case", "thehive:case_task"
|
"thehive:case",
|
||||||
|
"thehive:case_task"
|
||||||
],
|
],
|
||||||
"command": "Redmine/redmine.py",
|
"command": "Redmine/redmine.py",
|
||||||
"baseConfig": "Redmine",
|
"baseConfig": "Redmine",
|
||||||
@ -42,25 +43,32 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "project_field",
|
"name": "project_field",
|
||||||
"description": "Name of the custom field containing the Redmine project to use when craeting the issue",
|
"description": "Name of the custom field containing the Redmine project to use when creating the issue",
|
||||||
"multi": false,
|
"multi": false,
|
||||||
"required": true,
|
"required": true,
|
||||||
"type": "string"
|
"type": "string"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "tracker_field",
|
"name": "tracker_field",
|
||||||
"description": "Name of the custom field containing the Redmine tracker to use when craeting the issue",
|
"description": "Name of the custom field containing the Redmine tracker to use when creating the issue",
|
||||||
"multi": false,
|
"multi": false,
|
||||||
"required": true,
|
"required": true,
|
||||||
"type": "string"
|
"type": "string"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "assignee_field",
|
"name": "assignee_field",
|
||||||
"description": "Name of the custom field containing the Redmine assignee to use when craeting the issue",
|
"description": "Name of the custom field containing the Redmine assignee to use when creating the issue",
|
||||||
"multi": false,
|
"multi": false,
|
||||||
"required": false,
|
"required": false,
|
||||||
"type": "string"
|
"type": "string"
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"name": "reference_field",
|
||||||
|
"description": "Name of the case custom field in which to store the opened issue. If not defined, this information will not be stored",
|
||||||
|
"type": "string",
|
||||||
|
"required": false,
|
||||||
|
"multi": false
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"name": "opening_status",
|
"name": "opening_status",
|
||||||
"description": "Status used when opening a Redmine issue (if not defined here, will use the default opening status from the Redmine Workflow)",
|
"description": "Status used when opening a Redmine issue (if not defined here, will use the default opening status from the Redmine Workflow)",
|
||||||
|
@ -16,6 +16,7 @@ class Redmine(Responder):
|
|||||||
self.project_field = self.get_param('config.project_field', None, 'Missing custom field for Redmine project')
|
self.project_field = self.get_param('config.project_field', None, 'Missing custom field for Redmine project')
|
||||||
self.tracker_field = self.get_param('config.tracker_field', None, 'Missing custom field for Redmine tracker')
|
self.tracker_field = self.get_param('config.tracker_field', None, 'Missing custom field for Redmine tracker')
|
||||||
self.assignee_field = self.get_param('config.assignee_field', None, 'Missing custom field for Redmine assignee')
|
self.assignee_field = self.get_param('config.assignee_field', None, 'Missing custom field for Redmine assignee')
|
||||||
|
self.reference_field = self.get_param('config.reference_field', None)
|
||||||
|
|
||||||
def run(self):
|
def run(self):
|
||||||
issue_data = {}
|
issue_data = {}
|
||||||
@ -41,6 +42,8 @@ class Redmine(Responder):
|
|||||||
|
|
||||||
def operations(self, raw):
|
def operations(self, raw):
|
||||||
ops = []
|
ops = []
|
||||||
|
if self.reference_field:
|
||||||
|
ops.append(self.build_operation('AddCustomFields', name=self.reference_field, tpe='string', value='{}#{}'.format(self.instance_name, raw['issue']['issue']['id'])))
|
||||||
if self.data_type == 'thehive:case_task':
|
if self.data_type == 'thehive:case_task':
|
||||||
ops.append(self.build_operation('CloseTask'))
|
ops.append(self.build_operation('CloseTask'))
|
||||||
return ops
|
return ops
|
||||||
|
Loading…
Reference in New Issue
Block a user