Permalink
Browse files

Fix up the new life preserver backend to use the new "lpreserver list…

…cron" functionality for retrieving dataset info.
  • Loading branch information...
1 parent dbee72b commit a4521ebb8e0b24924ea8018b06c35d30f21b920c Ken Moore committed Aug 16, 2013
Showing with 17 additions and 2 deletions.
  1. +17 −2 life-preserver/LPBackend.cpp
@@ -138,7 +138,7 @@ bool LPBackend::removeDataset(QString dataset){
}
bool LPBackend::datasetInfo(QString dataset, int& time, int& numToKeep){
- QString cmd = "lpreserver cronsnap " + dataset;
+ QString cmd = "lpreserver listcron";
//Need output, so run this in a QProcess
QProcess *proc = new QProcess;
proc->setProcessChannelMode(QProcess::MergedChannels);
@@ -148,7 +148,22 @@ bool LPBackend::datasetInfo(QString dataset, int& time, int& numToKeep){
delete proc;
//Now process the output
bool ok = false;
- qDebug() << "lpreserver cronsnap:\n" << out;
+ for(int i=0; i<out.length(); i++){
+ if(out[i].section(" - ",0,0).simplified() == dataset){
+ //Get time schedule (in integer format)
+ QString sch = out[i].section(" - ",1,1).simplified();
+ if(sch.startsWith("daily@")){ time = sch.section("@",1,1).simplified().toInt(); }
+ else if(sch=="5min"){time = -5;}
+ else if(sch=="10min"){time = -10;}
+ else if(sch=="30min"){time = -30;}
+ else{ time = -60; } //hourly
+ //Get total snapshots
+ numToKeep = out[i].section("- total:",1,1).simplified().toInt();
+ ok=true;
+ break;
+ }
+ }
+ //qDebug() << "lpreserver cronsnap:\n" << out << QString::number(time) << QString::number(numToKeep);
return ok;
}

0 comments on commit a4521eb

Please sign in to comment.