Repository navigation
v0.7.0 - Critical Bug Fix for Sudo Operations
What's Fixed
This is a critical bug fix release that resolves issues preventing sudo operations from working correctly.
Critical Fixes
- PyInfra argument handling bug - The connector now correctly checks for PyInfra's underscore-prefixed arguments (
_sudo,_sudo_user) in addition to non-prefixed versions - Single-bit StringCommand sudo wrapping - Fixed "command not found" errors when using sudo with complex shell commands containing operators like
||,&&, pipes, ortimeout
Impact
v0.6.0 was broken - All sudo operations would fail because:
- PyInfra passes
_sudo=Truebut the connector only checked forsudo - Single-bit commands with shell operators would fail with "command not found"
v0.7.0 fixes both issues - All sudo operations now work correctly with PyInfra.
Affected Methods (All Fixed)
run_shell_command()- Now checks both_sudo/sudoand_sudo_user/sudo_userput_file()- Now checks both_sudo/sudoand_sudo_user/sudo_userget_file()- Now checks both_sudo/sudoand_sudo_user/sudo_user
Installation
pip install pyinfra-orbstack==0.7.0
# or
uv pip install pyinfra-orbstack==0.7.0Technical Details
Bug #1: Underscore-Prefixed Arguments
PyInfra's convention is to pass operation arguments with underscore prefixes:
# PyInfra passes:
arguments = {'_sudo': True, '_sudo_user': 'postgres'}
# v0.6.0 only checked:
sudo = arguments.get("sudo", False) # Would always be False!
# v0.7.0 correctly checks both:
sudo = arguments.get("sudo", arguments.get("_sudo", False))Bug #2: Single-Bit StringCommand Wrapping
Complex commands like timeout 60 bash -c '...' || true would fail with "command not found" because:
v0.6.0 (broken):
bits = ["timeout 60 bash -c '...' || true"]
bits = ["sudo", "-H"] + bits # Now 2 elements
cmd.extend(bits) # Result: sudo -H "complex || command" ❌v0.7.0 (fixed):
bits = ["timeout 60 bash -c '...' || true"]
if len(bits) == 1: # Check BEFORE adding sudo
quoted = shlex.quote(bits[0])
cmd.extend(["sh", "-c", f"sudo -H sh -c {quoted}"]) # ✅