-
Notifications
You must be signed in to change notification settings - Fork 24.2k
ssh connection: has_tty respects become plugin require_tty #86367
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
base: devel
Are you sure you want to change the base?
ssh connection: has_tty respects become plugin require_tty #86367
Conversation
|
Thanks for the review! I updated the ssh connection logic to avoid disabling pipelining when I also updated/added unit tests:
|
|
So the reason So I don't think this fix goes in the right direction, as it will hide the real underlying problem. |
bcoca
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would stress integration tests over unit tests in this case.
|
@bcoca The PR is unrelated to The underlying issue is specific to the ssh connection, and occurs here: https://github.com/ansible/ansible/blob/devel/lib/ansible/executor/task_executor.py#L1035-L1039. The ssh connection overrides has_tty and does not check whether the become plugin requires a tty. |
|
I'm not sure what the issue is then, that code in TE just makes sure the configurations are in agreement. If I'm reading the change correctly this basically overrides the user's conflicting configuration and gives priority to the become plugin? |
|
Prior to 7290959, has_tty was true for the ssh connection. The changelog suggests the only reason this was done, was to disable pipelining by default:
If the become plugin requires a TTY, it should do the same thing imo. An alternative fix would be to remove the has_tty property (so it's always True again), so |
|
talked with @s-hertel and realized that we have several issues:
use_tty should be factored in _build_command and then switch _is_tty_requested to use _build_command, so both paths match. Also make the default for has_tty 'smart' and depend on pipelining and become plugin settings |
Ignore my request, I had overlooked an earlier comment from bcoca.
|
I’ve dropped the |
Summary
Fixes #86298.
Since 2.19,
sshconnection has_tty uses _is_tty_requested() which only inspects ssh args and ignores theuse_ttyoption. This causes become plugins that require a TTY (e.g.community.general.machinectl) to fail even whenansible_ssh_use_tty/use_ttyis enabled.Changes
use_ttyis enabled, so has_tty matches exec_command() behavior.use_tty.Testing
Unit test added; CI will validate.