map<string, ProxyConfig> configs = snappers->getConfigs();
for (const map<string, ProxyConfig>::value_type& value : configs)
{
- const map<string, string>& raw = value.second.getAllValues();
+ const ProxyConfig& proxy_config = value.second;
- map<string, string>::const_iterator pos1 = raw.find("TIMELINE_CREATE");
- if (pos1 != raw.end() && pos1->second == "yes")
- {
- ProxySnapper* snapper = snappers->getSnapper(value.first);
+ if (!proxy_config.is_yes("TIMELINE_CREATE"))
+ continue;
- SCD scd;
- scd.description = "timeline";
- scd.cleanup = "timeline";
- scd.userdata = userdata;
+ cout << "running timeline for '" << value.first << "'." << endl;
- cout << "running timeline for '" << value.first << "'." << endl;
+ ProxySnapper* snapper = nullptr;
- if (!call_with_error_check([snapper, scd](){ snapper->createSingleSnapshot(scd); }))
- {
- cerr << "timeline for '" << value.first << "' failed." << endl;
- ok = false;
- }
+ if (!call_with_error_check([&snappers, &snapper, &value](){ snapper = snappers->getSnapper(value.first); }))
+ {
+ cerr << "timeline for '" << value.first << "' failed." << endl;
+ ok = false;
+ continue;
+ }
+
+ SCD scd;
+ scd.description = "timeline";
+ scd.cleanup = "timeline";
+ scd.userdata = userdata;
+
+ if (!call_with_error_check([snapper, scd](){ snapper->createSingleSnapshot(scd); }))
+ {
+ cerr << "timeline for '" << value.first << "' failed." << endl;
+ ok = false;
}
}
map<string, ProxyConfig> configs = snappers->getConfigs();
for (const map<string, ProxyConfig>::value_type& value : configs)
{
- const map<string, string>& raw = value.second.getAllValues();
+ const ProxyConfig& proxy_config = value.second;
+
+ bool do_number = proxy_config.is_yes("NUMBER_CLEANUP");
+ bool do_timeline = proxy_config.is_yes("TIMELINE_CLEANUP");
+ bool do_empty_pre_post = proxy_config.is_yes("EMPTY_PRE_POST_CLEANUP");
+
+ if (!do_number && !do_timeline && !do_empty_pre_post)
+ continue;
+
+ cout << "running cleanup for '" << value.first << "'." << endl;
- ProxySnapper* snapper = snappers->getSnapper(value.first);
+ ProxySnapper* snapper = nullptr;
- map<string, string>::const_iterator pos1 = raw.find("NUMBER_CLEANUP");
- if (pos1 != raw.end() && pos1->second == "yes")
+ if (!call_with_error_check([&snappers, &snapper, &value](){ snapper = snappers->getSnapper(value.first); }))
+ {
+ cerr << "cleanup for '" << value.first << "' failed." << endl;
+ ok = false;
+ continue;
+ }
+
+ if (do_number)
{
cout << "running number cleanup for '" << value.first << "'." << endl;
}
}
- map<string, string>::const_iterator pos2 = raw.find("TIMELINE_CLEANUP");
- if (pos2 != raw.end() && pos2->second == "yes")
+ if (do_timeline)
{
cout << "running timeline cleanup for '" << value.first << "'." << endl;
}
}
- map<string, string>::const_iterator pos3 = raw.find("EMPTY_PRE_POST_CLEANUP");
- if (pos3 != raw.end() && pos3->second == "yes")
+ if (do_empty_pre_post)
{
cout << "running empty-pre-post cleanup for '" << value.first << "'." << endl;