Skip to content

Commit

Permalink
Add configuration to allow closing tasks
Browse files Browse the repository at this point in the history
  • Loading branch information
srilumpa committed Sep 20, 2018
1 parent d366b60 commit 688e8a4
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
8 changes: 8 additions & 0 deletions responders/Redmine/Redmine_Issue.json
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,14 @@
"type": "string",
"multi": false,
"required": false
},
{
"name": "closing_task",
"description": "Closing the task after successfully creating the Redmine issue",
"type": "boolean",
"multi": false,
"defaultValue": false,
"required": false
}
]
}
3 changes: 2 additions & 1 deletion responders/Redmine/redmine.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ def __init__(self):
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.reference_field = self.get_param('config.reference_field', None)
self.closing_task = self.get_param('config.closing_task', False)

def run(self):
issue_data = {}
Expand Down Expand Up @@ -44,7 +45,7 @@ def operations(self, raw):
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' and self.closing_task:
ops.append(self.build_operation('CloseTask'))
return ops

Expand Down

0 comments on commit 688e8a4

Please sign in to comment.