fixed hostname not split (+) in python

This commit is contained in:
Erik Frojdh
2023-01-16 10:59:05 +01:00
committed by Dhanya Thattil
parent 39b1f5bbf2
commit f31fa92516
3 changed files with 51 additions and 9 deletions

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")