fixed hostname not split (+) in python

This commit is contained in:
Erik Frojdh authored and Dhanya Thattil committed 2023-01-16 13:34:01 +01:00
1 parent 39b1f5bbf2
commit f31fa92516
3 files changed
+51 -9

No files matched your search

+18 -1
View File
@@ -260,4 +260,21 @@ def merge_args(*args):
return (ret,)
else:
raise ValueError("Multiple dictionaries passes cannot merge args")
raise ValueError("Multiple dictionaries passes cannot merge args")
def hostname_list(args):
"""
Generates a list from a hostname string
* Lists are passed through
* as are tuples (conversion in pybind11 to vector)
* if + is found it splits the string
"""
if isinstance(args, (list, tuple)):
return args
elif(isinstance(args, str)):
hosts = args.split('+')
hosts = [it for it in hosts if len(it)]
return hosts
else:
raise ValueError("hostname needs to be string or list of strings")