aws-cloudformation / cloudformation-cli

The CloudFormation Provider Development Toolkit allows you to author your own resource providers and modules that can be used by CloudFormation.
Apache License 2.0
318 stars 161 forks source link

Fix prepare_payload_for_reinvocation in invoke #1027

Closed mircealam closed 1 year ago

mircealam commented 1 year ago

Description of changes:

This is for the use case where we are leveraging cfn invoke. Before the fix only the callbackContext was passedin leading to a situation where if the model is updated and the handler emits a progress event we would end up losing recoding the updates that were made (and making the handler fail for those instances).
One such example is when we are creating a resources and there are multiple API calls needed to materialize this resource with a progress event being emitted between this API calls and one of the later API calls needed info returned by the earlier calls and persisted in the model.

Validation:
seed isort known_third_party.............................................Passed
isort....................................................................Passed
black....................................................................Passed
check for case conflicts.................................................Passed
fix end of files.........................................................Passed
mixed line ending........................................................Passed
trim trailing whitespace.................................................Passed
pretty format json...................................(no files to check)Skipped
check for merge conflicts................................................Passed
flake8...................................................................Passed
check blanket noqa.......................................................Passed
check for not-real mock methods..........................................Passed
use logger.warning(......................................................Passed
bandit...................................................................Passed
pylint-local.............................................................Passed
pytest-local.............................................................Passed

In addition ran the cfn invoke and verified that the model is correctly passed back in

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.