mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
Add comment_visibility parameter for comment operation for jira module (#2556)
* Add comment_visibility parameter for comment operation for jira module Co-authored-by: felixfontein <felix@fontein.de> * Update plugins/modules/web_infrastructure/jira.py Co-authored-by: Felix Fontein <felix@fontein.de> * Update plugins/modules/web_infrastructure/jira.py Co-authored-by: Felix Fontein <felix@fontein.de> * addressed pep8 E711 * Added missing parameter. * params is not in use anymore. * It appears other modules are using options, where in documentation they use suboptions. Inconsistancy? * adjusted indentation * tweaked suboptions, fixed documentation * Added fragment * Update changelogs/fragments/2556-add-comment_visibility-parameter-for-comment-operation-of-jira-module.yml Co-authored-by: Felix Fontein <felix@fontein.de> * Update plugins/modules/web_infrastructure/jira.py Co-authored-by: Felix Fontein <felix@fontein.de> Co-authored-by: felixfontein <felix@fontein.de>
This commit is contained in:
parent
1403f5edcc
commit
7a169af053
2 changed files with 41 additions and 0 deletions
|
@ -0,0 +1,2 @@
|
||||||
|
minor_changes:
|
||||||
|
- jira - add comment visibility parameter for comment operation (https://github.com/ansible-collections/community.general/pull/2556).
|
|
@ -86,6 +86,25 @@ options:
|
||||||
- The comment text to add.
|
- The comment text to add.
|
||||||
- Note that JIRA may not allow changing field values on specific transitions or states.
|
- Note that JIRA may not allow changing field values on specific transitions or states.
|
||||||
|
|
||||||
|
comment_visibility:
|
||||||
|
type: dict
|
||||||
|
description:
|
||||||
|
- Used to specify comment comment visibility.
|
||||||
|
- See U(https://developer.atlassian.com/cloud/jira/platform/rest/v2/api-group-issue-comments/#api-rest-api-2-issue-issueidorkey-comment-post) for details.
|
||||||
|
suboptions:
|
||||||
|
type:
|
||||||
|
description:
|
||||||
|
- Use type to specify which of the JIRA visibility restriction types will be used.
|
||||||
|
type: str
|
||||||
|
required: true
|
||||||
|
choices: [group, role]
|
||||||
|
value:
|
||||||
|
description:
|
||||||
|
- Use value to specify value corresponding to the type of visibility restriction. For example name of the group or role.
|
||||||
|
type: str
|
||||||
|
required: true
|
||||||
|
version_added: '3.2.0'
|
||||||
|
|
||||||
status:
|
status:
|
||||||
type: str
|
type: str
|
||||||
required: false
|
required: false
|
||||||
|
@ -223,6 +242,18 @@ EXAMPLES = r"""
|
||||||
operation: comment
|
operation: comment
|
||||||
comment: A comment added by Ansible
|
comment: A comment added by Ansible
|
||||||
|
|
||||||
|
- name: Comment on issue with restricted visibility
|
||||||
|
community.general.jira:
|
||||||
|
uri: '{{ server }}'
|
||||||
|
username: '{{ user }}'
|
||||||
|
password: '{{ pass }}'
|
||||||
|
issue: '{{ issue.meta.key }}'
|
||||||
|
operation: comment
|
||||||
|
comment: A comment added by Ansible
|
||||||
|
comment_visibility:
|
||||||
|
type: role
|
||||||
|
value: Developers
|
||||||
|
|
||||||
# Assign an existing issue using edit
|
# Assign an existing issue using edit
|
||||||
- name: Assign an issue using free-form fields
|
- name: Assign an issue using free-form fields
|
||||||
community.general.jira:
|
community.general.jira:
|
||||||
|
@ -385,6 +416,10 @@ class JIRA(StateModuleHelper):
|
||||||
issuetype=dict(type='str', ),
|
issuetype=dict(type='str', ),
|
||||||
issue=dict(type='str', aliases=['ticket']),
|
issue=dict(type='str', aliases=['ticket']),
|
||||||
comment=dict(type='str', ),
|
comment=dict(type='str', ),
|
||||||
|
comment_visibility=dict(type='dict', options=dict(
|
||||||
|
type=dict(type='str', choices=['group', 'role'], required=True),
|
||||||
|
value=dict(type='str', required=True)
|
||||||
|
)),
|
||||||
status=dict(type='str', ),
|
status=dict(type='str', ),
|
||||||
assignee=dict(type='str', ),
|
assignee=dict(type='str', ),
|
||||||
fields=dict(default={}, type='dict'),
|
fields=dict(default={}, type='dict'),
|
||||||
|
@ -445,6 +480,10 @@ class JIRA(StateModuleHelper):
|
||||||
data = {
|
data = {
|
||||||
'body': self.vars.comment
|
'body': self.vars.comment
|
||||||
}
|
}
|
||||||
|
# if comment_visibility is specified restrict visibility
|
||||||
|
if self.vars.comment_visibility is not None:
|
||||||
|
data['visibility'] = self.vars.comment_visibility
|
||||||
|
|
||||||
url = self.vars.restbase + '/issue/' + self.vars.issue + '/comment'
|
url = self.vars.restbase + '/issue/' + self.vars.issue + '/comment'
|
||||||
self.vars.meta = self.post(url, data)
|
self.vars.meta = self.post(url, data)
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue