-
Notifications
You must be signed in to change notification settings - Fork 343
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Regression: cloudwatchevent_rule doesn't properly support JSON input_templates #1842
Closed
1 task done
Labels
Comments
jillr
added
needs_verified
Some one might want to take a look at this and reproduce it to confirm
jira
p2
and removed
needs_triage
labels
Nov 14, 2023
softwarefactory-project-zuul bot
pushed a commit
that referenced
this issue
Dec 18, 2023
cloudwatchevent_rule: Fix json input handling for input_template SUMMARY Fixes #1842 This PR Moves _snakify() out of class CloudWatchEventRule https://github.com/ansible-collections/amazon.aws/pull/1883/files#diff-3a2f223edc4e34ea28b9859827a830844d92a8cd97f1300a2d16b1703a083bc8R213-R215 Fixes conditional in function _targets_to_put() to avoid wrong results due to _snakify() https://github.com/ansible-collections/amazon.aws/pull/1883/files#diff-3a2f223edc4e34ea28b9859827a830844d92a8cd97f1300a2d16b1703a083bc8R461-R463 Updates code to add quotes " to input_template only when the given input is not JSON to avoid quotes being added to provided JSON input https://github.com/ansible-collections/amazon.aws/pull/1883/files#diff-3a2f223edc4e34ea28b9859827a830844d92a8cd97f1300a2d16b1703a083bc8R452-R458 ISSUE TYPE Bugfix Pull Request COMPONENT NAME cloudwatchevent_rule ADDITIONAL INFORMATION Reviewed-by: Bikouo Aubin Reviewed-by: Helen Bailey <[email protected]> Reviewed-by: Alina Buzachis Reviewed-by: Mandar Kulkarni <[email protected]>
patchback bot
pushed a commit
that referenced
this issue
Feb 8, 2024
cloudwatchevent_rule: Fix json input handling for input_template SUMMARY Fixes #1842 This PR Moves _snakify() out of class CloudWatchEventRule https://github.com/ansible-collections/amazon.aws/pull/1883/files#diff-3a2f223edc4e34ea28b9859827a830844d92a8cd97f1300a2d16b1703a083bc8R213-R215 Fixes conditional in function _targets_to_put() to avoid wrong results due to _snakify() https://github.com/ansible-collections/amazon.aws/pull/1883/files#diff-3a2f223edc4e34ea28b9859827a830844d92a8cd97f1300a2d16b1703a083bc8R461-R463 Updates code to add quotes " to input_template only when the given input is not JSON to avoid quotes being added to provided JSON input https://github.com/ansible-collections/amazon.aws/pull/1883/files#diff-3a2f223edc4e34ea28b9859827a830844d92a8cd97f1300a2d16b1703a083bc8R452-R458 ISSUE TYPE Bugfix Pull Request COMPONENT NAME cloudwatchevent_rule ADDITIONAL INFORMATION Reviewed-by: Bikouo Aubin Reviewed-by: Helen Bailey <[email protected]> Reviewed-by: Alina Buzachis Reviewed-by: Mandar Kulkarni <[email protected]> (cherry picked from commit 3b67513)
patchback bot
pushed a commit
that referenced
this issue
Feb 8, 2024
cloudwatchevent_rule: Fix json input handling for input_template SUMMARY Fixes #1842 This PR Moves _snakify() out of class CloudWatchEventRule https://github.com/ansible-collections/amazon.aws/pull/1883/files#diff-3a2f223edc4e34ea28b9859827a830844d92a8cd97f1300a2d16b1703a083bc8R213-R215 Fixes conditional in function _targets_to_put() to avoid wrong results due to _snakify() https://github.com/ansible-collections/amazon.aws/pull/1883/files#diff-3a2f223edc4e34ea28b9859827a830844d92a8cd97f1300a2d16b1703a083bc8R461-R463 Updates code to add quotes " to input_template only when the given input is not JSON to avoid quotes being added to provided JSON input https://github.com/ansible-collections/amazon.aws/pull/1883/files#diff-3a2f223edc4e34ea28b9859827a830844d92a8cd97f1300a2d16b1703a083bc8R452-R458 ISSUE TYPE Bugfix Pull Request COMPONENT NAME cloudwatchevent_rule ADDITIONAL INFORMATION Reviewed-by: Bikouo Aubin Reviewed-by: Helen Bailey <[email protected]> Reviewed-by: Alina Buzachis Reviewed-by: Mandar Kulkarni <[email protected]> (cherry picked from commit 3b67513)
softwarefactory-project-zuul bot
pushed a commit
that referenced
this issue
Feb 13, 2024
…) (#1968) [PR #1883/3b67513e backport][stable-7] cloudwatchevent_rule: Fix json input handling for input_template This is a backport of PR #1883 as merged into main (3b67513). SUMMARY Fixes #1842 This PR Moves _snakify() out of class CloudWatchEventRule https://github.com/ansible-collections/amazon.aws/pull/1883/files#diff-3a2f223edc4e34ea28b9859827a830844d92a8cd97f1300a2d16b1703a083bc8R213-R215 Fixes conditional in function _targets_to_put() to avoid wrong results due to _snakify() https://github.com/ansible-collections/amazon.aws/pull/1883/files#diff-3a2f223edc4e34ea28b9859827a830844d92a8cd97f1300a2d16b1703a083bc8R461-R463 Updates code to add quotes " to input_template only when the given input is not JSON to avoid quotes being added to provided JSON input https://github.com/ansible-collections/amazon.aws/pull/1883/files#diff-3a2f223edc4e34ea28b9859827a830844d92a8cd97f1300a2d16b1703a083bc8R452-R458 ISSUE TYPE Bugfix Pull Request COMPONENT NAME cloudwatchevent_rule ADDITIONAL INFORMATION Reviewed-by: Alina Buzachis
softwarefactory-project-zuul bot
pushed a commit
that referenced
this issue
Feb 13, 2024
…) (#1969) [PR #1883/3b67513e backport][stable-6] cloudwatchevent_rule: Fix json input handling for input_template This is a backport of PR #1883 as merged into main (3b67513). SUMMARY Fixes #1842 This PR Moves _snakify() out of class CloudWatchEventRule https://github.com/ansible-collections/amazon.aws/pull/1883/files#diff-3a2f223edc4e34ea28b9859827a830844d92a8cd97f1300a2d16b1703a083bc8R213-R215 Fixes conditional in function _targets_to_put() to avoid wrong results due to _snakify() https://github.com/ansible-collections/amazon.aws/pull/1883/files#diff-3a2f223edc4e34ea28b9859827a830844d92a8cd97f1300a2d16b1703a083bc8R461-R463 Updates code to add quotes " to input_template only when the given input is not JSON to avoid quotes being added to provided JSON input https://github.com/ansible-collections/amazon.aws/pull/1883/files#diff-3a2f223edc4e34ea28b9859827a830844d92a8cd97f1300a2d16b1703a083bc8R452-R458 ISSUE TYPE Bugfix Pull Request COMPONENT NAME cloudwatchevent_rule ADDITIONAL INFORMATION Reviewed-by: Alina Buzachis
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
Summary
I reported this same bug over in the community.aws collection last year. It seems to have returned in this code.
Please see the previous issue report for a detailed reproduction example.
Issue Type
Bug Report
Component Name
cloudwatchevent_rule
Ansible Version
$ ansible --version
Collection Versions
$ ansible-galaxy collection list
AWS SDK versions
$ pip show boto boto3 botocore
Configuration
$ ansible-config dump --only-changed
OS / Environment
No response
Steps to Reproduce
Here is a working example using the AWS CLI:
Which can be executed with a
aws events put-targets --cli-input-json file://eventbridge_target.json
However, when parsing the target configuration, the input is wrapped in a string:
AWS will not route an event with an invalid transformer template. So the input for a JSON template must begin with a
{
, not a"
. My solution was to remove the string wrapping, AND prepend the template with a space, as recommended here. This results in:Expected Results
I expected the input template to be wrapped by
{ ... }
but was instead"{ ... }"
Actual Results
Code of Conduct
The text was updated successfully, but these errors were encountered: