jira - resolve Cloud assignee email to account ID via user search (#11735)
* jira - resolve Cloud assignee email to account ID via user search
When cloud=true and assignee contains '@', look up a unique user with
GET /rest/api/2/user/search and use accountId for create, transition,
and edit. Document Jira Cloud vs Server/Data Center assignee behavior.
Fixes https://github.com/ansible-collections/community.general/issues/11734
Assisted-by AI: Claude 4.6 Opus (Anthropic) via Cursor IDE
* * Using urllib.parse.quote for URL encoding
* Adding "added in version" note for assignee when resolving account_id from email
* * Added cached variable 'user_email'
* Changed comparison to handle missing email safely
* Updated error message formatting to use repr-style values
* jira - adjust assignee and cloud descriptions (#11734)
* jira - resolve user-type field emails to account IDs on Jira Cloud (#11734)
When cloud=true, user-type fields (assignee, reporter, and any listed
in the new custom_user_fields parameter) that contain '@' are resolved
from email to Jira Cloud account ID via the user search API. Strings
without '@' are assumed to be account IDs. Add custom_user_fields
parameter for user to declare additional custom fields of user type.
* jira - address PR 11735 review (docs, assignee path, errors, naming)
- Clarify O(custom_user_fields): built-ins stay automatic; list extra
user-typed fields without implying they are only custom-field IDs.
- On Jira Cloud, set assignee from the module param as a plain string and
let resolve_user_fields() map it to accountId (including email lookup).
- Drop redundant ``or []`` when merging O(custom_user_fields) with the
built-in user field list.
- Use public names USER_FIELDS, resolve_user_fields, and resolve_account_id
(no leading underscore) per reviewer preference.
- Quote field name and email in resolution errors with explicit "…" text
instead of repr-style !r, keeping values readable in failure messages.
Refs: https://github.com/ansible-collections/community.general/pull/11735
AI-assisted: Composer 2 (Anthropic) via Cursor IDE
* Changing fail_json formatting
* formatting fixes
* jira - fixing assignee as module option in description
---------
(cherry picked from commit 3e9689b13d)
Signed-off-by: Vladimir Vasilev <vvasilev@redhat.com>
Co-authored-by: vladi-k <53343355+vladi-k@users.noreply.github.com>
jira - add cloud option to support Jira Cloud search endpoint (#11701)
* jira - add cloud option to support Jira Cloud search endpoint
Jira Cloud has removed the legacy GET /rest/api/2/search endpoint
(see https://developer.atlassian.com/changelog/#CHANGE-2046).
Add a new boolean `cloud` option (default false). When set to true,
the search operation uses the replacement /rest/api/2/search/jql
endpoint. The default remains false to preserve backward compatibility
for Jira Data Center / Server users.
Fixes: https://github.com/ansible-collections/community.general/issues/10786
Assisted-by AI: Claude 4.6 Opus (Anthropic) via Cursor IDE
* Adding PR link to changelogs/fragments/10786-jira-cloud-search.yml
* Adding note about future usage of cloud parameter
---------
(cherry picked from commit d956fb8197)
Signed-off-by: Vladimir Vasilev <vvasilev@redhat.com>
Co-authored-by: vladi-k <53343355+vladi-k@users.noreply.github.com>
Co-authored-by: Felix Fontein <felix@fontein.de>
Use raise from in modules (#11097)
* Use raise from.
* Add changelog fragment.
* Add comment.
(cherry picked from commit 40aea793ee)
Co-authored-by: Felix Fontein <felix@fontein.de>
* Get rid of all six.moves imports.
* Get rid of iteritems.
* Get rid of *_type(s) aliases.
* Replace StringIO import.
* Get rid of PY2/PY3 constants.
* Get rid of raise_from.
* Get rid of python_2_unicode_compatible.
* Clean up global six imports.
* Remove all usage of ansible.module_utils.six.
* Linting.
* Fix xml module.
* Docs adjustments.
* Adjust all __future__ imports:
for i in $(grep -REl "__future__.*absolute_import" plugins/ tests/); do
sed -e 's/from __future__ import .*/from __future__ import annotations/g' -i $i;
done
* Remove all UTF-8 encoding specifications for Python source files:
for i in $(grep -REl '[-][*]- coding: utf-8 -[*]-' plugins/ tests/); do
sed -e '/^# -\*- coding: utf-8 -\*-/d' -i $i;
done
* Remove __metaclass__ = type:
for i in $(grep -REl '__metaclass__ = type' plugins/ tests/); do
sed -e '/^__metaclass__ = type/d' -i $i;
done
* jira: add ssl client certificate support for authentification
* fix code bugs from first CI run
* fix fstring not compatible with older python and chhange urlopen module call
* removed duplicated post,put,get method
* fix urllib module detection Python2/ Python3
* edit HTTP Request back to fetch_url
* add changelog fragment
* fix python line spacing
* Update plugins/modules/jira.py
Co-authored-by: Felix Fontein <felix@fontein.de>
* Update plugins/modules/jira.py
Co-authored-by: Felix Fontein <felix@fontein.de>
* edit documentation certificate auth not mutually exclusive
* Update changelogs/fragments/9753-jira-add-client-certificate-auth.yml
Co-authored-by: Felix Fontein <felix@fontein.de>
* edit documentation for client certificate auth and token
* add no_log for client_cert and client_key
* removed no_log for client_cert and client_key
---------
Co-authored-by: domin <domin@MacBookPro.fritz.box>
Co-authored-by: Felix Fontein <felix@fontein.de>
* allow jira transition with target id
This is needed, because jira seems to autotranslate the status name
* add changelog fragment
* add newline to changelog fragment
* format according to pep 8
* switch formatting of fragment to LF
* implement suggestions on changelog fragment
* implement changes to module based on suggestions
* add status id as a alternative to status
* implement suggestions and add correct error handling
* fix up mistakes