Skip to content
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

[PR #2248/31112152 backport][stable-9] Refactor Some Command-Related Methods in aws_ssm.py #2261

Conversation

patchback[bot]
Copy link

@patchback patchback bot commented Mar 4, 2025

This is a backport of PR #2248 as merged into main (3111215).

SUMMARY

This work is part of the currently ongoing AWS SSM Connection Refactoring & Plugin Promotion effort and related to ansible-collections/amazon.aws#2394.

Fixes ACA-2095

ISSUE TYPE
  • Feature Pull Request
TASK LIST
  • The _exec_transport_commands method is refactored to accept a single structured object (a tuple containing lists of command dictionaries) that contains the necessary command data.
  • Create a custom dataclass to hold command output.
  • Create a custom dataclass TypedDict to hold command results.
  • The _generate_commands function returns a list of typed dictionaries with clear metadata (command strings, method, headers).
  • _exec_transport_commands accepts a list of typed dictionaries as an argument and returns the custom CommandResults object.
  • Python type hints are added to the method signature and the structured object to improve readability, facilitate static analysis, and clearly define the expected structure and data types.
  • Docstrings should be added to any refactored methods and the structured object (if custom), clarifying the purpose, structure, inputs, outputs, and any edge cases or special handling (if applicable).
  • Unit tests have been created to ensure that the refactored _generate_commands method outputs the expected structured command object.
  • Add a changelog file.

SUMMARY

This work is part of the currently ongoing AWS SSM Connection Refactoring & Plugin Promotion effort and related to ansible-collections/amazon.aws#2394.
Fixes ACA-2095

ISSUE TYPE

Feature Pull Request

TASK LIST

 The _exec_transport_commands method is refactored to accept a single structured object (a tuple containing lists of command dictionaries) that contains the necessary command data.
 Create a custom dataclass to hold command output.
 Create a custom dataclass TypedDict to hold command results.
 The _generate_commands function returns a list of typed dictionaries with clear metadata (command strings, method, headers).
 _exec_transport_commands accepts a list of typed dictionaries as an argument and returns the custom CommandResults object.
 Python type hints are added to the method signature and the structured object to improve readability, facilitate static analysis, and clearly define the expected structure and data types.
 Docstrings should be added to any refactored methods and the structured object (if custom), clarifying the purpose, structure, inputs, outputs, and any edge cases or special handling (if applicable).
 Unit tests have been created to ensure that the refactored _generate_commands method outputs the expected structured command object.
 Add a changelog file.

Reviewed-by: Bikouo Aubin
Reviewed-by: Rahmanim Benny <[email protected]>
Reviewed-by: Alina Buzachis
Reviewed-by: GomathiselviS <[email protected]>
Reviewed-by: Mark Chappell
Reviewed-by: Bianca Henderson <[email protected]>
Reviewed-by: Mike Graves <[email protected]>
(cherry picked from commit 3111215)
Copy link
Contributor

Build succeeded.
https://ansible.softwarefactory-project.io/zuul/buildset/d07a9e5da05946b084f0ab28f692a0fe

✔️ ansible-galaxy-importer SUCCESS in 3m 37s (non-voting)
✔️ build-ansible-collection SUCCESS in 11m 23s
✔️ ansible-test-splitter SUCCESS in 4m 01s
✔️ integration-community.aws-1 SUCCESS in 26m 05s
✔️ integration-community.aws-2 SUCCESS in 15m 00s
✔️ integration-community.aws-3 SUCCESS in 17m 49s
✔️ integration-community.aws-4 SUCCESS in 15m 16s
✔️ integration-community.aws-5 SUCCESS in 14m 19s
✔️ integration-community.aws-6 SUCCESS in 16m 52s
✔️ integration-community.aws-7 SUCCESS in 14m 16s
✔️ integration-community.aws-8 SUCCESS in 14m 12s
✔️ integration-community.aws-9 SUCCESS in 17m 03s
✔️ integration-community.aws-10 SUCCESS in 6m 11s
✔️ integration-community.aws-11 SUCCESS in 15m 43s
Skipped 11 jobs

@beeankha beeankha added the mergeit Merge the PR (SoftwareFactory) label Mar 13, 2025
Copy link
Contributor

Build succeeded (gate pipeline).
https://ansible.softwarefactory-project.io/zuul/buildset/ed3c0b8a690340d8b486c32d09274c3c

ansible-galaxy-importer POST_FAILURE in 4m 19s (non-voting)
✔️ build-ansible-collection SUCCESS in 10m 16s
✔️ ansible-test-splitter SUCCESS in 3m 52s
✔️ integration-community.aws-1 SUCCESS in 24m 17s
✔️ integration-community.aws-2 SUCCESS in 15m 46s
✔️ integration-community.aws-3 SUCCESS in 13m 19s
✔️ integration-community.aws-4 SUCCESS in 16m 47s
✔️ integration-community.aws-5 SUCCESS in 14m 07s
✔️ integration-community.aws-6 SUCCESS in 17m 43s
✔️ integration-community.aws-7 SUCCESS in 15m 29s
✔️ integration-community.aws-8 SUCCESS in 14m 36s
✔️ integration-community.aws-9 SUCCESS in 13m 05s
✔️ integration-community.aws-10 SUCCESS in 5m 26s
✔️ integration-community.aws-11 SUCCESS in 13m 36s
Skipped 11 jobs

@softwarefactory-project-zuul softwarefactory-project-zuul bot merged commit b2b2ff0 into stable-9 Mar 13, 2025
82 of 83 checks passed
@softwarefactory-project-zuul softwarefactory-project-zuul bot deleted the patchback/backports/stable-9/311121522ef21f2126e7f0b42121df0092db090c/pr-2248 branch March 13, 2025 19:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
mergeit Merge the PR (SoftwareFactory)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants