def do_validate_config(args): log_warn_only() validation_errors = backend.do_validate_config() if validation_errors: print_validation_errors(validation_errors) return 1 return 0
def configure_status(request): """Return /configure/status :param request: a web requeest object. :type request: request | None """ log.info("Request for configuration validation made.") code = 200 messages = backend.do_validate_config() if messages: code = 400 resp = web.json_response(messages, status=code) return resp
def test_do_validate_config(tmpdir): # Create a temp config workspace = tmpdir.strpath temp_config_path = workspace + '/config.yaml' expected_output = { 'ssh_user': '******', 'master_list': 'required parameter master_list was not provided', } # remove num_masters and masters_quorum since they can change between runs messages = backend.do_validate_config(temp_config_path) assert messages['ssh_user'] == expected_output['ssh_user'] assert messages['master_list'] == expected_output['master_list']
def test_do_validate_config(tmpdir): # Create a temp config workspace = tmpdir.strpath temp_config_path = workspace + '/config.yaml' expected_output = { 'ssh_user': '******', 'master_list': 'Must set master_list, no way to calculate value.', } # remove num_masters and masters_quorum since they can change between runs messages = backend.do_validate_config(temp_config_path) assert messages['ssh_user'] == expected_output['ssh_user'] assert messages['master_list'] == expected_output['master_list']