Source: ansible-core
Source-Version: 2.14.3-1
Severity: important
Tags: fixed-upstream, patch, upstream
Dear Maintainer,
the attached patch applied in upstream commit [0] will fix ansible-core
2.14.3-1 in Debian 12 Bookworm having an issue with the URI module
recognizing JSON with some API endpoints correctly.
I am using this module in many tasks with the CEPH Dashboard API and
confirm the patch is fixing it successfully. Without the patch, all
these tasks are failing after installing a fresh Debian Bookworm.
Note:
The ansible version in Bullseye was working fine in this regard.
Upstream has an open PR [1] against stable-2.14, but not merged yet.
I would have opened a Merge Request on Salsa, but I just registered and
waiting for approval.
[0]
https://github.com/ansible/ansible/commit/0c7361d9acf7c8966a09f67de2a8679ef86fd856
[1] https://github.com/ansible/ansible/pull/80870
With Best Regards
Berni
--- /usr/lib/python3/dist-packages/ansible/modules/uri.py 2023-03-01 21:06:21.000000000 +0100
+++ /tmp/uri.py 2023-06-03 16:51:49.224330090 +0200
@@ -699,7 +699,14 @@
sub_type = 'octet-stream'
content_encoding = 'utf-8'
- maybe_json = content_type and sub_type.lower() in JSON_CANDIDATES
+ if sub_type and '+' in sub_type:
+ # https://www.rfc-editor.org/rfc/rfc6839#section-3.1
+ sub_type_suffix = sub_type.partition('+')[2]
+ maybe_json = content_type and sub_type_suffix.lower() in JSON_CANDIDATES
+ elif sub_type:
+ maybe_json = content_type and sub_type.lower() in JSON_CANDIDATES
+ else:
+ maybe_json = False
maybe_output = maybe_json or return_content or info['status'] not in status_code
if maybe_output: