diff options
author | Slezhuk Evgeniy <e.slezhuk@qiwi.ru> | 2016-04-28 17:00:11 +0200 |
---|---|---|
committer | Matt Clay <matt@mystile.com> | 2016-12-08 17:35:17 +0100 |
commit | 867c85af0534c32c0bcddf450f2f15d7457ad2a6 (patch) | |
tree | 5ed2274657d8d89f57725cb52b891011d821b4e7 /lib | |
parent | Add check mode support (#3523) (diff) | |
download | ansible-867c85af0534c32c0bcddf450f2f15d7457ad2a6.tar.xz ansible-867c85af0534c32c0bcddf450f2f15d7457ad2a6.zip |
Add 'link' action to jira module
Diffstat (limited to 'lib')
-rwxr-xr-x | lib/ansible/modules/extras/web_infrastructure/jira.py | 44 |
1 files changed, 41 insertions, 3 deletions
diff --git a/lib/ansible/modules/extras/web_infrastructure/jira.py b/lib/ansible/modules/extras/web_infrastructure/jira.py index e7d1e1a901..3947f15f32 100755 --- a/lib/ansible/modules/extras/web_infrastructure/jira.py +++ b/lib/ansible/modules/extras/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 ) |