def validate_workers(workers): if not isinstance(workers, list): raise ConfigurationError('Workers must be of type list. Found ' + str(type(workers)) + '.') if len(workers) < 1: raise ConfigurationError('Must specify at least one worker') for worker in workers: validate_host(worker) return workers
def validate_coordinator(coordinator): validate_host(coordinator) return coordinator
def test_valid_hostname(self): host = "master" self.assertEqual(validators.validate_host(host), host)
def test_valid_full_ipv6(self): ipv6 = "FE80:0000:0000:0000:0202:B3FF:FE1E:8329" self.assertEqual(validators.validate_host(ipv6), ipv6)
def test_valid_collapsed_ipv6(self): ipv6 = "FE80::0202:B3FF:FE1E:8329" self.assertEqual(validators.validate_host(ipv6), ipv6)
def test_valid_ipv4(self): ipv4 = "10.14.1.10" self.assertEqual(validators.validate_host(ipv4), ipv4)