From aebb74d46cc37b6a35f871c6ae508622a2e27f6f Mon Sep 17 00:00:00 2001
From: ramonn <noreply@pandorafms.org>
Date: Wed, 17 Apr 2013 18:01:49 +0000
Subject: [PATCH] 2013-04-17  Ramon Novoa  <rnovoa@artica.es>

	* unix/pandora_agent: Empty the configuration hash before reloading
	  the configuration.



git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@8008 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
---
 pandora_agents/ChangeLog          | 5 +++++
 pandora_agents/unix/pandora_agent | 7 +++++--
 2 files changed, 10 insertions(+), 2 deletions(-)

diff --git a/pandora_agents/ChangeLog b/pandora_agents/ChangeLog
index a77e397b97..7cee71ef0b 100644
--- a/pandora_agents/ChangeLog
+++ b/pandora_agents/ChangeLog
@@ -1,3 +1,8 @@
+2013-04-17  Ramon Novoa  <rnovoa@artica.es>
+
+	* unix/pandora_agent: Empty the configuration hash before reloading
+	  the configuration.
+
 2013-04-15  Ramon Novoa  <rnovoa@artica.es>
 
 	* win32/pandora_windows_service.cc: Open the XML data file in binary
diff --git a/pandora_agents/unix/pandora_agent b/pandora_agents/unix/pandora_agent
index 4a2e90a068..e77357e9ea 100755
--- a/pandora_agents/unix/pandora_agent
+++ b/pandora_agents/unix/pandora_agent
@@ -931,13 +931,16 @@ sub check_remote_config () {
 	return if (recv_file ($RemoteConfFile) != 0);
 	log_message ('remote config', 'Configuration has changed!');
 
+	# Save the new configuration
+	move ("$Conf{'temporal'}/$RemoteConfFile", "$ConfDir/$ConfFile");
+
 	# Empty modules, plugins and collections
 	@Modules = ();
 	@Plugins = ();
 	%Collections = ();
+	%Conf = %DefaultConf;
 
-	# Save the new configuration and reload it
-	move ("$Conf{'temporal'}/$RemoteConfFile", "$ConfDir/$ConfFile");
+	# Reload the new configuration
 	read_config ();
 	
 	# Log file may have changed