diff options
author | Slezhuk Evgeniy <e.slezhuk@qiwi.ru> | 2016-04-28 18:00:11 +0300 |
---|---|---|
committer | Toshio Kuratomi <a.badger@gmail.com> | 2016-12-06 05:08:02 -0800 |
commit | cc9e9cde6d558ab30e783b60757434cfca7b29c0 (patch) | |
tree | a65772ea1e49d88fc083e83b6f8af523444a3f67 | |
parent | ee18fdede0adeec89a023b83f9365f74b0d7563b (diff) | |
download | ansible-modules-extras-cc9e9cde6d558ab30e783b60757434cfca7b29c0.tar.gz |
Add 'link' action to jira module
-rwxr-xr-x | web_infrastructure/jira.py | 44 |
1 files changed, 41 insertions, 3 deletions
diff --git a/web_infrastructure/jira.py b/web_infrastructure/jira.py index e7d1e1a9..3947f15f 100755 --- a/web_infrastructure/jira.py +++ b/web_infrastructure/jira.py @@ -91,6 +91,24 @@ options: description: - Sets the assignee on create or transition operations. Note not all transitions will allow this. + linktype: + required: false + version_added: 2.3 + description: + - Set type of link, when action 'link' selected + + inwardissue: + required: false + version_added: 2.3 + description: + - set issue from which link will be created + + outwardissue: + required: false + version_added: 2.3 + description: + - set issue to which link will be created + fields: required: false description: @@ -179,6 +197,10 @@ EXAMPLES = """ name: '{{ issue.meta.fields.creator.name }}' comment: '{{issue.meta.fields.creator.displayName }}' +- name: Create link from HSP-1 to MKY-1 + jira: uri={{server}} username={{user}} password={{pass}} operation=link + linktype=Relate inwardissue=HSP-1 outwardissue=MKY-1 + # Transition an issue by target status - name: Close the issue jira: @@ -315,13 +337,26 @@ def transition(restbase, user, passwd, params): return ret +def link(restbase, user, passwd, params): + data = { + 'type': { 'name': params['linktype'] }, + 'inwardIssue': { 'key': params['inwardissue'] }, + 'outwardIssue': { 'key': params['outwardissue'] }, + } + + url = restbase + '/issueLink/' + + ret = post(url, user, passwd, data) + + return ret # Some parameters are required depending on the operation: OP_REQUIRED = dict(create=['project', 'issuetype', 'summary', 'description'], comment=['issue', 'comment'], edit=[], fetch=['issue'], - transition=['status']) + transition=['status'], + link=['linktype', 'inwardissue', 'outwardissue']) def main(): @@ -329,7 +364,7 @@ def main(): module = AnsibleModule( argument_spec=dict( uri=dict(required=True), - operation=dict(choices=['create', 'comment', 'edit', 'fetch', 'transition'], + operation=dict(choices=['create', 'comment', 'edit', 'fetch', 'transition', 'link'], aliases=['command'], required=True), username=dict(required=True), password=dict(required=True), @@ -341,7 +376,10 @@ def main(): comment=dict(), status=dict(), assignee=dict(), - fields=dict(default={}, type='dict') + fields=dict(default={}, type='dict'), + linktype=dict(), + inwardissue=dict(), + outwardissue=dict(), ), supports_check_mode=False ) |