8000 refactor connection/aws_ssm plugin by abikouo · Pull Request #2275 · ansible-collections/community.aws · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

refactor connection/aws_ssm plugin #2275

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

Conversation

abikouo
Copy link
Contributor
@abikouo abikouo commented Apr 1, 2025
SUMMARY

Refactor S3 operation function from connection/aws_ssm plugin
Refer to: https://issues.redhat.com/browse/ACA-2100

ISSUE TYPE
  • Feature Pull Request

Copy link
Contributor

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

✔️ ansible-galaxy-importer SUCCESS in 3m 11s (non-voting)
✔️ build-ansible-collection SUCCESS in 10m 43s
✔️ ansible-test-splitter SUCCESS in 4m 00s
✔️ integration-community.aws-1 SUCCESS in 23m 53s
✔️ integration-community.aws-2 SUCCESS in 16m 18s
✔️ integration-community.aws-3 SUCCESS in 15m 05s
✔️ integration-community.aws-4 SUCCESS in 15m 50s
✔️ integration-community.aws-5 SUCCESS in 14m 03s
✔️ integration-community.aws-6 SUCCESS in 14m 35s
✔️ integration-community.aws-7 SUCCESS in 14m 49s
✔️ integration-community.aws-8 SUCCESS in 15m 46s
✔️ integration-community.aws-9 SUCCESS in 15m 00s
✔️ integration-community.aws-10 SUCCESS in 5m 29s
✔️ integration-community.aws-11 SUCCESS in 15m 41s
Skipped 11 jobs

Copy link
Contributor

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

✔️ ansible-galaxy-importer SUCCESS in 3m 26s (non-voting)
✔️ build-ansible-collection SUCCESS in 10m 35s
✔️ ansible-test-splitter SUCCESS in 4m 00s
✔️ integration-community.aws-1 SUCCESS in 23m 18s
✔️ integration-community.aws-2 SUCCESS in 13m 58s
✔️ integration-community.aws-3 SUCCESS in 12m 31s
✔️ integration-community.aws-4 SUCCESS in 14m 44s
✔️ integration-community.aws-5 SUCCESS in 24m 12s
✔️ integration-community.aws-6 SUCCESS in 15m 17s
✔️ integration-community.aws-7 SUCCESS in 13m 36s
✔️ integration-community.aws-8 SUCCESS in 13m 39s
✔️ integration-community.aws-9 SUCCESS in 17m 22s
✔️ integration-community.aws-10 SUCCESS in 5m 36s
✔️ integration-community.aws-11 SUCCESS in 12m 39s
Skipped 11 jobs

@abikouo abikouo requested a review from GomathiselviS April 7, 2025 12:25
Copy link
Contributor

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

ansible-galaxy-importer FAILURE in 5m 57s (non-voting)
✔️ build-ansible-collection SUCCESS in 10m 39s
✔️ ansible-test-splitter SUCCESS in 4m 03s
✔️ integration-community.aws-1 SUCCESS in 23m 05s
✔️ integration-community.aws-2 SUCCESS in 16m 06s
✔️ integration-community.aws-3 SUCCESS in 16m 40s
✔️ integration-community.aws-4 SUCCESS in 16m 16s
✔️ integration-community.aws-5 SUCCESS in 15m 34s
✔️ integration-community.aws-6 SUCCESS in 13m 58s
✔️ integration-community.aws-7 SUCCESS in 15m 28s
✔️ integration-community.aws-8 SUCCESS in 16m 44s
✔️ integration-community.aws-9 SUCCESS in 17m 25s
✔️ integration-community.aws-10 SUCCESS in 8m 42s
✔️ integration-community.aws-11 SUCCESS in 16m 35s
Skipped 11 jobs

region_name: Optional[str] = None,
endpoint_url: Optional[str] = None,
config: Optional[Dict[str, Any]] = None,
):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should the return type be BaseClient ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The botocore does use type hint, it is hard to deduced so putting Any as returned value is enough

command = None
url = None
put_args = None
if method == "get":
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this right? I am little confused as you are using put_args and "PUT" method under this. Would you mind using the correct variable names and method values to avoid the confusion?

Copy link
Contributor
@beeankha beeankha Apr 7, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, this is confusing at first glance but it's correct (I was also puzzled by this when working on #2248). @abikouo please correct me if I'm wrong but from my understanding, the reason for this apparent contradiction is that the code is handling file transfers between a local machine and a remote AWS instance via S3 as an intermediary. The ssm_action refers to what the user/caller wants to do (get a file from the remote instance or put a file to the remote instance), while the method in the commands refers to what the remote instance needs to do.

@GomathiselviS @abikouo do you think it might be helpful to add some comments to clarify why the specified methods seem to be the opposite of what they should be?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the clarification, @beeankha. Yes, comments would be helpful for posterity.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@beeankha, you are right!! The file transfer generates 2 commands, one for the controller node and another for the managed node. The controller node uses the AWS S3 API to download/put file to S3 bucket while the managed node uses the curl command to download/upload file to bucket.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The function description has been updated

@abikouo abikouo force-pushed the refactor_aws_ssm_s3_operation branch from caba9b3 to 242aae1 Compare April 8, 2025 09:38
Copy link
Contributor

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

ansible-galaxy-importer FAILURE in 4m 59s (non-voting)
✔️ build-ansible-collection SUCCESS in 10m 50s
✔️ ansible-test-splitter SUCCESS in 4m 03s
✔️ integration-community.aws-1 SUCCESS in 25m 06s
✔️ integration-community.aws-2 SUCCESS in 16m 18s
✔️ integration-community.aws-3 SUCCESS in 15m 03s
✔️ integration-community.aws-4 SUCCESS in 15m 19s
✔️ integration-community.aws-5 SUCCESS in 15m 35s
✔️ integration-community.aws-6 SUCCESS in 14m 14s
✔️ integration-community.aws-7 SUCCESS in 16m 13s
✔️ integration-community.aws-8 SUCCESS in 14m 05s
✔️ integration-community.aws-9 SUCCESS in 15m 02s
✔️ integration-community.aws-10 SUCCESS in 6m 34s
✔️ integration-community.aws-11 SUCCESS in 16m 17s
Skipped 11 jobs

@abikouo abikouo added mergeit Merge the PR (SoftwareFactory) backport-9 PR should be backported to the stable-9 branch labels Apr 11, 2025
Copy link
Contributor

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

ansible-galaxy-importer FAILURE in 3m 47s (non-voting)
✔️ build-ansible-collection SUCCESS in 11m 07s
✔️ ansible-test-splitter SUCCESS in 3m 59s
✔️ integration-community.aws-1 SUCCESS in 21m 18s
✔️ integration-community.aws-2 SUCCESS in 14m 12s
✔️ integration-community.aws-3 SUCCESS in 14m 16s
✔️ integration-community.aws-4 SUCCESS in 13m 01s
✔️ integration-community.aws-5 SUCCESS in 13m 07s
✔️ integration-community.aws-6 SUCCESS in 13m 27s
✔️ integration-community.aws-7 SUCCESS in 13m 15s
✔️ integration-community.aws-8 SUCCESS in 13m 00s
✔️ integration-community.aws-9 SUCCESS in 13m 21s
✔️ integration-community.aws-10 SUCCESS in 4m 13s
✔️ integration-community.aws-11 SUCCESS in 14m 32s
Skipped 11 jobs

@softwarefactory-project-zuul softwarefactory-project-zuul bot merged commit b41876d into ansible-collections:main Apr 11, 2025
86 of 87 checks passed
Copy link
patchback bot commented Apr 11, 2025

Backport to stable-9: 💚 backport PR created

✅ Backport PR branch: patchback/backports/stable-9/b41876d3fa108eaca7bbe1c1bd909d8c9f1d173e/pr-2275

Backported as #2280

🤖 @patchback
I'm built with octomachinery and
my source is open — https://github.com/sanitizers/patchback-github-app.

patchback bot pushed a commit that referenced this pull request Apr 11, 2025
SUMMARY
Refactor S3 operation function from connection/aws_ssm plugin
Refer to: https://issues.redhat.com/browse/ACA-2100
ISSUE TYPE

Feature Pull Request

Reviewed-by: GomathiselviS <gomathiselvi@gmail.com>
Reviewed-by: Bianca Henderson <beeankha@gmail.com>
Reviewed-by: Bikouo Aubin
(cherry picked from commit b41876d)
softwarefactory-project-zuul bot pushed a commit that referenced this pull request Apr 11, 2025
This is a backport of PR #2275 as merged into main (b41876d).
SUMMARY
Refactor S3 operation function from connection/aws_ssm plugin
Refer to: https://issues.redhat.com/browse/ACA-2100
ISSUE TYPE


Feature Pull Request

Reviewed-by: Bikouo Aubin
mandar242 pushed a commit to mandar242/community.aws that referenced this pull request Apr 23, 2025
SUMMARY
Refactor S3 operation function from connection/aws_ssm plugin
Refer to: https://issues.redhat.com/browse/ACA-2100
ISSUE TYPE


Feature Pull Request

Reviewed-by: GomathiselviS <gomathiselvi@gmail.com>
Reviewed-by: Bianca Henderson <beeankha@gmail.com>
Reviewed-by: Bikouo Aubin

This commit was initially merged in https://github.com/ansible-collections/community.aws
See: ansible-collections@b41876d
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport-9 PR should be backported to the stable-9 branch mergeit Merge the PR (SoftwareFactory)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants
0