Updated common.parse_compute_hosts to allow host names that include - and _

This commit is contained in:
Anton Beloglazov 2015-03-24 16:16:44 +11:00
parent d1407fc796
commit 1b1a3b64f3
2 changed files with 3 additions and 1 deletions

View File

@ -249,7 +249,7 @@ def parse_compute_hosts(compute_hosts):
:return: A list of host names.
:rtype: list(str)
"""
return filter(None, re.split('\W+', compute_hosts))
return filter(None, re.split('[^a-zA-Z0-9\-_]+', compute_hosts))
@contract

View File

@ -156,6 +156,8 @@ class Common(TestCase):
assert common.parse_compute_hosts('') == []
assert common.parse_compute_hosts('test1, test2') == \
['test1', 'test2']
assert common.parse_compute_hosts('test-1, test_2') == \
['test-1', 'test_2']
assert common.parse_compute_hosts('t1,, t2 , t3') == \
['t1', 't2', 't3']