8000 connection/aws_ssm - create TerminalManager class and move related methods by mandar242 · Pull Request #2270 · ansible-collections/community.aws · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
Dismiss alert
< 8000 h1 class="gh-header-title mb-2 lh-condensed f1 mr-0 flex-auto wb-break-word"> connection/aws_ssm - create TerminalManager class and move related methods #2270
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

mandar242
Copy link
Contributor
SUMMARY

create TerminalManager class and move related methods
ACA-2102

ISSUE TYPE
  • Feature Pull Request
COMPONENT NAME

connection/aws_ssm

ADDITIONAL INFORMATION

This comment was marked as outdated.

Copy link
Contributor

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

ansible-galaxy-importer FAILURE in 4m 44s (non-voting)
✔️ build-ansible-collection SUCCESS in 10m 41s
✔️ ansible-test-splitter SUCCESS in 4m 18s
✔️ integration-community.aws-1 SUCCESS in 22m 01s
✔️ integration-community.aws-2 SUCCESS in 14m 18s
✔️ integration-community.aws-3 SUCCESS in 14m 36s
✔️ integration-community.aws-4 SUCCESS in 14m 22s
✔️ integration-community.aws-5 SUCCESS in 14m 31s
✔️ integration-community.aws-6 SUCCESS in 16m 51s
✔️ integration-community.aws-7 SUCCESS in 15m 48s
✔️ integration-community.aws-8 SUCCESS in 15m 23s
✔️ integration-community.aws-9 SUCCESS in 14m 20s
✔️ integration-community.aws-10 SUCCESS in 10m 09s
✔️ integration-community.aws-11 SUCCESS in 13m 37s
Skipped 11 jobs

@abikouo
Copy link
Contributor
abikouo commented Mar 31, 2025

@mandar242 We did duplicate work. I think having one SSMSessionManager class responsible for configuring the terminal makes more sense. If you agree we can close this and have this instead #2272

@alinabuzachis
Copy link
Contributor

@mandar242 We did duplicate work. I think having one SSMSessionManager class responsible for configuring the terminal makes more sense. If you agree we can close this and have this instead #2272

I do not think the work is duplicate. Each class should have smaller focus scope (I did copy-paste from the refactoring proposal):

SSMSessionManager: Handles everything related to starting and managing the SSM session (e.g., start_session, _connect, exec_command).

TerminalManager: Handles terminal configurations (e.g., _prepare_terminal, _wrap_command, etc.).

Let me know please if you have any concerns/thoughts.

@GomathiselviS
Copy link
Contributor

We did duplicate work. I think having one SSMSessionManager class responsible for configuring the terminal makes more sense. If you agree we can close this and have this instead #2272

Having a more modular approach is generally better for maintainability. As per the proposal, it makes sense to have a separate class instead of consolidating everything into SSMSessionManager.

Copy link
Contributor
@abikouo abikouo left a comment

Choose a reason for hiding this comment

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

Hey, @mandar242 I pushed some suggestions to restrict the class to the necessary information so that it can be reusable

This comment was marked as outdated.

@mandar242 mandar242 force-pushed the terminal_manager_class branch from ad8249b to be6ec2f Compare April 3, 2025 00:35
@mandar242 mandar242 force-pushed the terminal_manager_class branch from be6ec2f to 8994d34 Compare April 3, 2025 00:44
@mandar242 mandar242 force-pushed the terminal_manager_class branch from 8994d34 to aa5d89e Compare April 3, 2025 00:52

This comment was marked as outdated.

Copy link
Member
@gravesm gravesm left a comment

Choose a reason for hiding this comment

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

I disagree with @abikouo's suggestion:

Having the connection as a parameter does not make the class reusable; we should pass only the necessary options needed by the class

What you did originally, passing the instance of the connection class, is dependency injection and is usually the better, more flexible way to do things. If you want to continue with your current approach, there are issues around variable initialization you'll need to resolve. Given the timing of when those are initialized in the Connection class, I think it will be difficult to coordinate passing them to the TerminalManager class during initialization.

@mandar242
Copy link
Contributor Author
mandar242 commented Apr 3, 2025

terminal_manager

I disagree with @abikouo's suggestion:

Having the connection as a parameter does not make the class reusable; we should pass only the necessary options needed by the class

What you did originally, passing the instance of the connection class, is dependency injection and is usually the better, more flexible way to do things. If you want to continue with your current approach, there are issues around variable initialization you'll need to resolve. Given the timing of when those are initialized in the Connection class, I think it will be difficult to coordinate passing them to the TerminalManager class during initialization.

Makes sense, surely it adds complexity. I’ve reverted the code to use the full connection again for cleaner code.

@mandar242 mandar242 requested a review from gravesm April 3, 2025 19:13
Copy link
Contributor

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

✔️ ansible-galaxy-importer SUCCESS in 3m 17s (non-voting)
✔️ build-ansible-collection SUCCESS in 10m 37s
✔️ ansible-test-splitter SUCCESS in 4m 37s
✔️ integration-community.aws-1 SUCCESS in 21m 49s
✔️ integration-community.aws-2 SUCCESS in 14m 59s
✔️ integration-community.aws-3 SUCCESS in 14m 51s
✔️ integration-community.aws-4 SUCCESS in 13m 54s
✔️ integration-community.aws-5 SUCCESS in 15m 14s
✔️ integration-community.aws-6 SUCCESS in 14m 50s
✔️ integration-community.aws-7 SUCCESS in 15m 36s
✔️ integration-community.aws-8 SUCCESS in 13m 28s
✔️ integration-community.aws-9 SUCCESS in 15m 24s
✔️ integration-community.aws-10 SUCCESS in 4m 30s
✔️ integration-community.aws-11 SUCCESS in 15m 03s
Skipped 11 jobs

Copy link
Contributor
@GomathiselviS GomathiselviS left a comment

Choose a reason for hiding this comment

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

Multiple occurrences of # pylint: disable=unreachable appear unnecessary because there's no conditional blocking those statements. I might be wrong, but they should be checked.

@mandar242 mandar242 requested a review from GomathiselviS April 7, 2025 20:17
@mandar242 mandar242 added the mergeit Merge the PR (SoftwareFactory) label Apr 7, 2025
@github-actions github-actions bot added the backport-9 PR should be backported to the stable-9 branch label Apr 7, 2025
Copy link
Contributor

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

ansible-galaxy-importer FAILURE in 4m 24s (non-voting)
✔️ build-ansible-collection SUCCESS in 10m 23s
✔️ ansible-test-splitter SUCCESS in 4m 04s
✔️ integration-community.aws-1 SUCCESS in 23m 06s
✔️ integration-community.aws-2 SUCCESS in 15m 35s
✔️ integration-community.aws-3 SUCCESS in 16m 45s
✔️ integration-community.aws-4 SUCCESS in 18m 00s
✔️ integration-community.aws-5 SUCCESS in 16m 38s
✔️ integration-community.aws-6 SUCCESS in 16m 20s
✔️ integration-community.aws-7 SUCCESS in 14m 40s
✔️ integration-community.aws-8 SUCCESS in 17m 09s
✔️ integration-community.aws-9 SUCCESS in 15m 16s
✔️ integration-community.aws-10 SUCCESS in 8m 47s
✔️ integration-community.aws-11 SUCCESS in 14m 46s
Skipped 11 jobs

@softwarefactory-project-zuul softwarefactory-project-zuul bot merged commit 2c1e8c4 into ansible-collections:main Apr 7, 2025
85 of 87 checks passed
Copy link
patchback bot commented Apr 7, 2025

Backport to stable-9: 💚 backport PR created

✅ Backport PR branch: patchback/backports/stable-9/2c1e8c492b73ad34afa206f2faefff76f54190be/pr-2270

Backported as #2277

🤖 @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 7, 2025
…thods (#2270)

SUMMARY

create TerminalManager class and move related methods
ACA-2102

ISSUE TYPE

Feature Pull Request

COMPONENT NAME

connection/aws_ssm
ADDITIONAL INFORMATION

Reviewed-by: Bikouo Aubin
Reviewed-by: Mandar Kulkarni <mandar242@gmail.com>
Reviewed-by: Mike Graves <mgraves@redhat.com>
Reviewed-by: GomathiselviS <gomathiselvi@gmail.com>
(cherry picked from commit 2c1e8c4)
softwarefactory-project-zuul bot pushed a commit that referenced this pull request Apr 9, 2025
…thods (#2270) (#2277)

This is a backport of PR #2270 as merged into main (2c1e8c4).
SUMMARY

create TerminalManager class and move related methods
ACA-2102

ISSUE TYPE


Feature Pull Request

COMPONENT NAME

connection/aws_ssm
ADDITIONAL INFORMATION

Reviewed-by: Alina Buzachis
@mandar242 mandar242 deleted the terminal_manager_class branch April 22, 2025 20:23
mandar242 added a commit to mandar242/community.aws that referenced this pull request Apr 23, 2025
…related methods (ansible-collections#2270)

SUMMARY

create TerminalManager class and move related methods
ACA-2102

ISSUE TYPE


Feature Pull Request

COMPONENT NAME

connection/aws_ssm
ADDITIONAL INFORMATION

Reviewed-by: Bikouo Aubin
Reviewed-by: Mandar Kulkarni <mandar242@gmail.com>
Reviewed-by: Mike Graves <mgraves@redhat.com>
Reviewed-by: GomathiselviS <gomathiselvi@gmail.com>

This commit was initially merged in https://github.com/ansible-collections/community.aws
See: ansible-collections@2c1e8c4
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.

5 participants
0