Commit 9745f40c authored by Matthieu Dorier's avatar Matthieu Dorier

added proper checks of input connection file

parent 262c744e
......@@ -136,19 +136,33 @@ class DataStoreImpl {
}
if(!databasesNode.IsMap()) {
throw Exception("\"databases\" entry should be a map");
} /*
for(auto provider_it = databasesNode.begin(); provider_it != databasesNode.end(); provider_it++) {
// provider entry should be a sequence
if(!provider.IsSequence()) {
throw Exception("provider entry should be a sequence");
}
// database entry has keys datasets, runs, subruns, events, and products.
std::vector<std::string> fields = { "datasets", "runs", "subruns", "events", "products" };
for(auto& f : fields) {
auto fieldNode = databasesNode[f];
if(!fieldNode) {
throw Exception("\""+f+"\" entry not found in databases section");
}
if(!fieldNode.IsMap()) {
throw Exception("\""+f+"\" entry should be a mapping from addresses to providers");
}
for(auto db : provider) {
if(!db.IsScalar()) {
throw Exception("database id should be a scalar");
for(auto addresses_it = fieldNode.begin(); addresses_it != fieldNode.end(); addresses_it++) {
auto providers = addresses_it->second;
for(auto provider_it = providers.begin(); provider_it != providers.end(); provider_it++) {
// provider entry should be a sequence
if(!provider_it->second.IsSequence()) {
std::cerr << "Error, provider_it->second is " << provider_it->second << std::endl;
throw Exception("provider entry should be a sequence");
}
for(auto db : provider_it->second) {
if(!db.IsScalar()) {
throw Exception("database id should be a scalar");
}
}
}
}
}
*/
}
public:
......@@ -304,7 +318,7 @@ class DataStoreImpl {
prefix.resize(1);
}
// issue an sdskv_list_keys
std::vector<std::string> entries(maxKeys);
std::vector<std::string> entries(maxKeys, std::string(1024,'\0'));
try {
db.list_keys(lb_entry, prefix, entries);
} catch(sdskv::exception& ex) {
......
......@@ -15,7 +15,7 @@ cp config.yaml $TEST_DIR/config.yaml
CFG_FILE=$TEST_DIR/config.yaml
sed -i -e "s|XXX|${TEST_DIR}/database|g" $CFG_FILE
hepnos_test_start_servers 2 1 20 $CFG_FILE $CON_FILE
hepnos_test_start_servers 2 2 20 $CFG_FILE $CON_FILE
export HEPNOS_CONFIG_FILE=$CON_FILE
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment