mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
jira: Use fields in comment to merge in additional data (#4304)
* jira: Use fields in comment to merge in additional data * changlog fragment added * Update changelogs/fragments/4304-jira-fields-in-comment.yml Co-authored-by: Felix Fontein <felix@fontein.de> * updated fields documentation * Update plugins/modules/web_infrastructure/jira.py Co-authored-by: Felix Fontein <felix@fontein.de> Co-authored-by: Felix Fontein <felix@fontein.de>
This commit is contained in:
parent
c0415b9fae
commit
4fbba96841
2 changed files with 21 additions and 0 deletions
2
changelogs/fragments/4304-jira-fields-in-comment.yml
Normal file
2
changelogs/fragments/4304-jira-fields-in-comment.yml
Normal file
|
@ -0,0 +1,2 @@
|
|||
minor_changes:
|
||||
- jira - when creating a comment, ``fields`` now is used for additional data (https://github.com/ansible-collections/community.general/pull/4304).
|
|
@ -158,6 +158,7 @@ options:
|
|||
- This is a free-form data structure that can contain arbitrary data. This is passed directly to the JIRA REST API
|
||||
(possibly after merging with other required data, as when passed to create). See examples for more information,
|
||||
and the JIRA REST API for the structure required for various fields.
|
||||
- When passed to comment, the data structure is merged at the first level since community.general 4.6.0. Useful to add JIRA properties for example.
|
||||
- Note that JIRA may not allow changing field values on specific transitions or states.
|
||||
|
||||
jql:
|
||||
|
@ -261,6 +262,20 @@ EXAMPLES = r"""
|
|||
type: role
|
||||
value: Developers
|
||||
|
||||
- name: Comment on issue with property to mark it internal
|
||||
community.general.jira:
|
||||
uri: '{{ server }}'
|
||||
username: '{{ user }}'
|
||||
password: '{{ pass }}'
|
||||
issue: '{{ issue.meta.key }}'
|
||||
operation: comment
|
||||
comment: A comment added by Ansible
|
||||
fields:
|
||||
properties:
|
||||
- key: 'sd.public.comment'
|
||||
value:
|
||||
internal: true
|
||||
|
||||
# Assign an existing issue using edit
|
||||
- name: Assign an issue using free-form fields
|
||||
community.general.jira:
|
||||
|
@ -502,6 +517,10 @@ class JIRA(StateModuleHelper):
|
|||
if self.vars.comment_visibility is not None:
|
||||
data['visibility'] = self.vars.comment_visibility
|
||||
|
||||
# Use 'fields' to merge in any additional data
|
||||
if self.vars.fields:
|
||||
data.update(self.vars.fields)
|
||||
|
||||
url = self.vars.restbase + '/issue/' + self.vars.issue + '/comment'
|
||||
self.vars.meta = self.post(url, data)
|
||||
|
||||
|
|
Loading…
Reference in a new issue