From: Kyr Shatskyy Date: Thu, 30 Jan 2025 11:18:24 +0000 (+0100) Subject: orchestra/run: better handle weird args X-Git-Tag: 1.2.2~38^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=0c7d9c51dbccfe5f5b3ae36499e38fd7c8794447;p=teuthology.git orchestra/run: better handle weird args If one of the command args in remote.run is None then there is exception occurs while trying to qoute argument list: TypeError: expected string or bytes-like object This fix addresses the issue and gives user better idea what is happening, and how to fix the error. Fixes: https://tracker.ceph.com/issues/64452 Signed-off-by: Kyr Shatskyy --- diff --git a/teuthology/orchestra/run.py b/teuthology/orchestra/run.py index bf6a06953..7f6fdb240 100644 --- a/teuthology/orchestra/run.py +++ b/teuthology/orchestra/run.py @@ -242,15 +242,21 @@ class Raw(object): def quote(args): """ - Internal quote wrapper. + Internal quote wrapper. None arguments are not allowed. + + :param args: list of str or Raw objects + + :raises: :class:`RuntimeError`: if one of the args is None. """ def _quote(args): """ Handle quoted string, testing for raw charaters. """ - for a in args: + for i, a in enumerate(args): if isinstance(a, Raw): yield a.value + elif a is None: + raise RuntimeError(f"Argument at position {i} is None: {args}") else: yield shlex.quote(a) if isinstance(args, list):