apt_repository errors out with multiline strings with trailing newline #82393
Labels
affects_2.16
bug
This issue/PR relates to a bug.
module
This issue/PR relates to a module.
needs_verified
This issue needs to be verified/reproduced by maintainer
P3
Priority 3 - Approved, No Time Limitation
Summary
I tried to switch from Ansible 2.15.7 to 2.16.1 and discovered, that apt_repository fails on me when I try to run a task as described in the steps to reproduce.
I did some quick debugging and saw, that in module_utils/basic.py:376 the buffere contains some json including the input with its newline. The newline then causes
json.loads
to fail.My simple (and probably correct) fix was to replace
>
with>-
to strip the trailing newline. However, I did not find any mention of this behaviour change in the porting guide (since this did work in 2.15.7) and without some debugging I could have never known the true reason for this error, so the error message could be improved (verbose logging did not help).Issue Type
Bug Report
Component Name
apt_repository
Ansible Version
Configuration
OS / Environment
Ubuntu 23.10 running on WSL
Steps to Reproduce
Expected Results
Either this just works (as in 2.15) or the error I get is more helpful for me to actually understand, what I'm doing wrong.
Actual Results
Code of Conduct
The text was updated successfully, but these errors were encountered: