We had a patch earlier to make us not use sudo unless the
user is not root for our other commands, but this specific
one that just runs "true" with a timeout to check if the host
is online was missed.
Fixes: https://tracker.ceph.com/issues/57369
Signed-off-by: Adam King <adking@redhat.com>
(cherry picked from commit
c638d295dd30e202777314571b1075de3334becc)
cmd = sudo_prefix + " ".join(quote(x) for x in cmd)
logger.debug(f'Running command: {cmd}')
try:
- r = await conn.run('sudo true', check=True, timeout=5)
+ r = await conn.run(f'{sudo_prefix}true', check=True, timeout=5)
r = await conn.run(cmd, input=stdin)
# handle these Exceptions otherwise you might get a weird error like TypeError: __init__() missing 1 required positional argument: 'reason' (due to the asyncssh error interacting with raise_if_exception)
except (asyncssh.ChannelOpenError, asyncssh.ProcessError, Exception) as e: