From cefa9bdf5d1031478199d59fa21783191ccf43d4 Mon Sep 17 00:00:00 2001 From: Nexusrex18 Date: Fri, 2 Jan 2026 17:05:50 +0530 Subject: [PATCH] [connection] Support list/tuple arguments in custom commands #809 The input_data property previously used ', '.join(self.arguments) directly, causing TypeError when arguments are lists. This change safely flattens list/tuple arguments to comma-separated strings and converts all items to str, preventing the error while preserving backward compatibility. Fixes #809 --- openwisp_controller/connection/base/models.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/openwisp_controller/connection/base/models.py b/openwisp_controller/connection/base/models.py index 55f75c5f7..51d9c839e 100644 --- a/openwisp_controller/connection/base/models.py +++ b/openwisp_controller/connection/base/models.py @@ -639,7 +639,13 @@ def input_data(self): if self.is_custom: return self.custom_command else: - return ", ".join(self.arguments) + processed = [] + for arg in self.arguments: + if isinstance(arg, (list, tuple)): + processed.append(",".join(str(item) for item in arg)) + else: + processed.append(str(arg)) + return ", ".join(processed) @property def _schema(self):