[refactor] Use pythonic way to join in list_to_target_string
Change-Id: I0b64d943e48457600f5b34c1b24888edd673df17
diff --git a/cvp_checks/utils/__init__.py b/cvp_checks/utils/__init__.py
index 74af967..810894e 100644
--- a/cvp_checks/utils/__init__.py
+++ b/cvp_checks/utils/__init__.py
@@ -43,11 +43,10 @@
return local
-def list_to_target_string(node_list, separator):
- result = ''
- for node in node_list:
- result += node + ' ' + separator + ' '
- return result[:-(len(separator)+2)]
+def list_to_target_string(node_list, separator, add_spaces=True):
+ if add_spaces:
+ separator = ' ' + separator.strip() + ' '
+ return separator.join(node_list)
def get_monitoring_ip(param_name):