Do not delete collections if a broker is configured (win32).
This commit is contained in:
parent
a10f2a6d2e
commit
1f4f9d8cb3
|
@ -33,6 +33,7 @@ using namespace Pandora_Strutils;
|
|||
Pandora::Pandora_Agent_Conf::Pandora_Agent_Conf () {
|
||||
this->key_values = NULL;
|
||||
this->collection_list = NULL;
|
||||
this->broker_enabled = false;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -202,6 +203,7 @@ Pandora::Pandora_Agent_Conf::setFile (string *all_conf){
|
|||
string path_broker, name_broker;
|
||||
int pos_c;
|
||||
int position = 0;
|
||||
this->broker_enabled = true;
|
||||
|
||||
name_broker = buffer.substr(pos+13);
|
||||
path_broker = name_broker+".conf";
|
||||
|
@ -460,3 +462,14 @@ bool
|
|||
Pandora::Pandora_Agent_Conf::isLastCollection() {
|
||||
return collection_it == collection_list->end();
|
||||
}
|
||||
|
||||
/**
|
||||
* Check whether there are broker agents configured.
|
||||
*
|
||||
* @return True if there is at least one broker agent.
|
||||
*
|
||||
*/
|
||||
bool
|
||||
Pandora::Pandora_Agent_Conf::isBrokerEnabled() {
|
||||
return this->broker_enabled;
|
||||
}
|
||||
|
|
|
@ -45,6 +45,7 @@ namespace Pandora {
|
|||
list<Key_Value> *key_values;
|
||||
list<Collection> *collection_list;
|
||||
list<Collection>::iterator collection_it;
|
||||
bool broker_enabled;
|
||||
|
||||
Pandora_Agent_Conf ();
|
||||
public:
|
||||
|
@ -64,6 +65,7 @@ namespace Pandora {
|
|||
|
||||
bool isLastCollection ();
|
||||
bool isInCollectionList(string name);
|
||||
bool isBrokerEnabled ();
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
@ -1083,6 +1083,11 @@ Pandora_Windows_Service::purgeDiskCollections () {
|
|||
struct stat file;
|
||||
string tmp, filepath;
|
||||
|
||||
/*Do not delete collections if there is a broker agent*/
|
||||
if (conf->isBrokerEnabled()) {
|
||||
return;
|
||||
}
|
||||
|
||||
filepath = Pandora::getPandoraInstallDir() +"collections\\";
|
||||
/*Open the directory*/
|
||||
dir = opendir (filepath.c_str ());
|
||||
|
|
Loading…
Reference in New Issue