Skip to content

feat(connectors): fail fast when target uses sudo-rs#1876

Draft
wowi42 wants to merge 3 commits into
pyinfra-dev:3.xfrom
KalvadTech:feat/fail-on-sudo-rs
Draft

feat(connectors): fail fast when target uses sudo-rs#1876
wowi42 wants to merge 3 commits into
pyinfra-dev:3.xfrom
KalvadTech:feat/fail-on-sudo-rs

Conversation

@wowi42

@wowi42 wowi42 commented Jul 10, 2026

Copy link
Copy Markdown
Collaborator

Closes #1499 (in a way)...

Detects when the target host uses sudo-rs instead of traditional sudo by running sudo --version on the first use of _sudo. If sudo-rs is detected, pyinfra fails fast with a clear error message rather than failing later with a cryptic authentication error.

  • Detection result is cached per host in host.connector_data.
  • Added tests for both SSH and local connectors.

@wowi42 wowi42 mentioned this pull request Jul 10, 2026
@wowi42 wowi42 added new feature connectors Connector issues - builtin integrations with other tools. labels Jul 10, 2026
@0cjs

0cjs commented Jul 10, 2026

Copy link
Copy Markdown

This should not close #1499, and I'd rather not see this released because it will break things worse for me. (I currently have things working with sudo-rs and a monekypatch.) See that issue for details.

Sorry about not getting this information to you earlier.

@wowi42

wowi42 commented Jul 10, 2026

Copy link
Copy Markdown
Collaborator Author

Updated the branch. It now:

  • Detects sudo-rs versions < 0.2.11 and fails fast with a clear message.
  • Allows sudo-rs 0.2.11+ to run normally.
  • Adds sudo: interactive authentication is required to the password-retry detection, which is the prefix sudo-rs 0.2.13 uses.
  • Adds tests for unsupported sudo-rs, supported sudo-rs, and the new password-retry prefix.

@0cjs if you can pull this branch and test on your Ubuntu 26.04/26.10 hosts, that would confirm the fix in a real environment.

@wowi42 wowi42 marked this pull request as draft July 10, 2026 13:12
@0cjs

0cjs commented Jul 10, 2026

Copy link
Copy Markdown

Unfortunately we've hit the last day of the week and I and my co-workers don't have time to do this today. We'll try for next week, but I'd suggest in the long term you spin up container hosts for testing these kinds of things. We've found that to be very helpful, though I'm not in a position to release the code for that any time soon, unfortunately.

(Though thank you for reminding me; I now may have an idea why our container host didn't catch this when we tried it with Ubuntu 26.04.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

connectors Connector issues - builtin integrations with other tools. new feature

Projects

None yet

Development

Successfully merging this pull request may close these issues.

sudo-rs not supported

2 participants