Beispiel #1
0
def validate(conf):
    for key in conf.keys():
        if key not in PRESTO_ADMIN_PROPERTIES:
            raise ConfigurationError('Invalid property: ' + key)

    try:
        username = conf['username']
    except KeyError:
        pass
    else:
        validate_username(username)

    try:
        coordinator = conf['coordinator']
    except KeyError:
        pass
    else:
        validate_coordinator(coordinator)

    try:
        workers = conf['workers']
    except KeyError:
        pass
    else:
        validate_workers(workers)

    try:
        ssh_port = conf['ssh-port']
    except KeyError:
        pass
    else:
        validate_port(ssh_port)
    return conf
Beispiel #2
0
def validate(conf):
    for key in conf.keys():
        if key not in PRESTO_ADMIN_PROPERTIES:
            raise ConfigurationError('Invalid property: ' + key)

    try:
        username = conf['username']
    except KeyError:
        pass
    else:
        conf['username'] = validate_username(username)

    try:
        java8_home = conf['java8_home']
    except KeyError:
        pass
    else:
        conf['java8_home'] = validate_java8_home(java8_home)

    try:
        coordinator = conf['coordinator']
    except KeyError:
        pass
    else:
        conf['coordinator'] = validate_coordinator(coordinator)

    try:
        workers = conf['workers']
    except KeyError:
        pass
    else:
        workers = [h for host in workers for h in _expand_host(host)]
        conf['workers'] = validate_workers(workers)

    try:
        port = conf['port']
    except KeyError:
        pass
    else:
        conf['port'] = validate_port(port)
    return conf
Beispiel #3
0
def validate(conf):
    for key in conf.keys():
        if key not in PRESTO_ADMIN_PROPERTIES:
            raise ConfigurationError('Invalid property: ' + key)

    try:
        username = conf['username']
    except KeyError:
        pass
    else:
        conf['username'] = validate_username(username)

    try:
        java_home = conf['java_home']
    except KeyError:
        pass
    else:
        conf['java_home'] = validate_java_home(java_home)

    try:
        coordinator = conf['coordinator']
    except KeyError:
        pass
    else:
        conf['coordinator'] = validate_coordinator(coordinator)

    try:
        workers = conf['workers']
    except KeyError:
        pass
    else:
        workers = [h for host in workers for h in _expand_host(host)]
        conf['workers'] = validate_workers(workers)

    try:
        port = conf['port']
    except KeyError:
        pass
    else:
        conf['port'] = validate_port(port)
    return conf
 def test_valid_port(self):
     port = 1234
     self.assertEqual(validators.validate_port(port), port)
Beispiel #5
0
 def test_valid_port(self):
     port = 1234
     self.assertEqual(validators.validate_port(port), port)