[icinga-checkins] icinga.org: icinga2/support/2.5: Ensure that UpdateConfigObject sets the target zone

git at icinga.org git at icinga.org
Thu Nov 17 13:51:08 CET 2016


Module: icinga2
Branch: support/2.5
Commit: e5a6bdc0041d58f7e602305c5a3a803ccaf1fe4f
URL:    https://git.icinga.org/?p=icinga2.git;a=commit;h=e5a6bdc0041d58f7e602305c5a3a803ccaf1fe4f

Author: Michael Friedrich <michael.friedrich at icinga.com>
Date:   Thu Nov 10 17:15:06 2016 +0100

Ensure that UpdateConfigObject sets the target zone

refs #11684

---

 lib/remote/apilistener-configsync.cpp |   10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/lib/remote/apilistener-configsync.cpp b/lib/remote/apilistener-configsync.cpp
index 7e5ead4..4fd05e4 100644
--- a/lib/remote/apilistener-configsync.cpp
+++ b/lib/remote/apilistener-configsync.cpp
@@ -342,8 +342,14 @@ void ApiListener::UpdateConfigObject(const ConfigObject::Ptr& object, const Mess
 
 	if (client)
 		JsonRpc::SendMessage(client->GetStream(), message);
-	else
-		RelayMessage(origin, object, message, false);
+	else {
+		Zone::Ptr target = static_pointer_cast<Zone>(object->GetZone());
+
+		if (!target)
+			target = Zone::GetLocalZone();
+
+		RelayMessage(origin, target, message, false);
+	}
 }
 
 



More information about the icinga-checkins mailing list