Commit bc6dc415 authored by Carla Guillen Carias's avatar Carla Guillen Carias
Browse files

Adding check for the type of backend

parent 398fa5ef
......@@ -73,8 +73,9 @@ void PerSystSqlConfigurator::operatorAttributes(PerSystSqlOperator& op, CFG_VAL
std::string user;
std::string password;
std::string database_name;
int port;
int port = -1;
PerSystDB::Rotation_t rotation = PerSystDB::EVERY_MONTH;
PerSystSqlOperator::Backend_t backend = PerSystSqlOperator::DEFAULT;
unsigned int every_x_days = 0;
BOOST_FOREACH(boost::property_tree::iptree::value_type &val, config) {
if (boost::iequals(val.first, "number_quantiles")) {
......@@ -105,8 +106,10 @@ void PerSystSqlConfigurator::operatorAttributes(PerSystSqlOperator& op, CFG_VAL
op.setSeverityMaxMemory(max_memory);
} else if (boost::iequals(val.first, "backend")) {
if(val.second.data() == "cassandra") {
backend = PerSystSqlOperator::CASSANDRA;
op.setBackend(PerSystSqlOperator::CASSANDRA);
} else if(val.second.data() == "mariadb") {
backend = PerSystSqlOperator::MARIADB;
op.setBackend(PerSystSqlOperator::MARIADB);
}
} else if(boost::iequals(val.first, "property_id")){
......@@ -132,7 +135,9 @@ void PerSystSqlConfigurator::operatorAttributes(PerSystSqlOperator& op, CFG_VAL
} else if (boost::iequals(val.first, "mariadb_every_x_days")){
every_x_days = std::stoi(val.second.data());
}
op.setMariaDBConnection(host, user, password, database_name, port, rotation, every_x_days);
if(backend == PerSystSqlOperator::MARIADB) {
op.setMariaDBConnection(host, user, password, database_name, port, rotation, every_x_days);
}
}
}
......
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