From 16406b4cd48f054749ad6a039a8a5728fc858b15 Mon Sep 17 00:00:00 2001 From: Xiangce Liu Date: Sun, 29 Sep 2024 20:34:02 +0800 Subject: [PATCH] fix: datasource passed unicode to foreach_execute in py26 (#4232) - when collecting in py26 env, if the foreach_execute specs depends on DatasourceProvider, the provider will be in unicode type and causes the followed validate() fail - this change converted the unicode to string by force for all 'cmd' passed to CommandOutputProvider Signed-off-by: Xiangce Liu rh-pre-commit.version: 2.3.1 rh-pre-commit.check-secrets: ENABLED --- insights/core/spec_factory.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/insights/core/spec_factory.py b/insights/core/spec_factory.py index 9b1de9ad07..2abf7e14f1 100644 --- a/insights/core/spec_factory.py +++ b/insights/core/spec_factory.py @@ -940,7 +940,7 @@ def __init__(self, cmd, provider, save_as=None, context=HostContext, deps=None, split=True, keep_rc=False, timeout=None, inherit_env=None, override_env=None, signum=None, **kwargs): deps = deps if deps is not None else [] - self.cmd = cmd + self.cmd = cmd if six.PY3 else str(cmd) self.provider = provider self.save_as = save_as.strip("/") if save_as else None # strip as a relative file path self.context = context