]> granicus.if.org Git - icinga2/commitdiff
Removed rpclistener/rpcconnection config object types.
authorGunnar Beutner <gunnar.beutner@netways.de>
Tue, 8 May 2012 10:03:24 +0000 (12:03 +0200)
committerGunnar Beutner <gunnar.beutner@netways.de>
Tue, 8 May 2012 11:03:29 +0000 (13:03 +0200)
components/discovery/discoverycomponent.cpp
icinga-app/icinga1.conf
icinga-app/icinga2.conf
icinga-app/icinga3.conf
icinga/icingaapplication.cpp

index eba78fe372cf97a3b20a82413bc81c1470cd6cb5..0017659229d887a0f72dbf5cbf5e0936f56468fa 100644 (file)
@@ -44,6 +44,7 @@ void DiscoveryComponent::Start(void)
 
        GetEndpointManager()->RegisterEndpoint(m_DiscoveryEndpoint);
 
+       /* create the reconnect timer */
        m_DiscoveryTimer = make_shared<Timer>();
        m_DiscoveryTimer->SetInterval(30);
        m_DiscoveryTimer->OnTimerExpired += bind_weak(&DiscoveryComponent::DiscoveryTimerHandler, shared_from_this());
index 4af7a7192be2a07b792e1d75c2170f88d1a3c7f9..7dabac5452ada3a1ebd5a2b218017d295b23215d 100644 (file)
@@ -12,8 +12,5 @@
                "configrpc": { "replicate": "0", "configSource": "1" },
                "demo": { "replicate": "0" },
                "discovery": { "replicate": "0", "broker": "1" }
-       },
-       "rpclistener": {
-               "kekslistener": { "replicate": "0", "service": "7777" }
        }
 }
\ No newline at end of file
index 64faf3fd43831184472a27cad57c2ca02ae5e1f8..7a1e37222464266ee820fae724a92a03492f945b 100644 (file)
@@ -13,9 +13,6 @@
                "demo": { "replicate": "0" },
                "discovery": { "replicate": "0", "broker": "0" }
        },
-       "rpclistener": {
-               "kekslistener": { "replicate": "0", "service": "8888" }
-       },
        "broker": {
                "icinga-c1": { "replicate": "0", "node": "10.0.10.3", "service": "7777" }
        }
index c72f195a93ee9f6cf7fc9a967f3a6f8e6903c2e2..75643c75e012d349fa69348eb232cfef9f3efe1e 100644 (file)
@@ -13,9 +13,6 @@
                "demo": { "replicate": "0" },
                "discovery": { "replicate": "0", "broker": "0" }
        },
-       "rpclistener": {
-               "kekslistener": { "replicate": "0", "service": "9999" }
-       },
        "broker": {
                "icinga-c1": { "replicate": "0", "node": "10.0.10.3", "service": "7777" }
        }
index 09fe759dd726058f4b15688b6ab57fb2301b65e9..8fd2f318de45cf8d0c1ddb506c0227845eadc13e 100644 (file)
@@ -27,13 +27,6 @@ int IcingaApplication::Main(const vector<string>& args)
        string componentDirectory = GetExeDirectory() + "/../lib/icinga";
        AddComponentSearchDir(componentDirectory);
 
-       /* register handler for 'component' config objects */
-       ConfigCollection::Ptr componentCollection = GetConfigHive()->GetCollection("component");
-       function<int (const EventArgs&)> NewComponentHandler = bind_weak(&IcingaApplication::NewComponentHandler, shared_from_this());
-       componentCollection->OnObjectCreated += NewComponentHandler;
-       componentCollection->ForEachObject(NewComponentHandler);
-       componentCollection->OnObjectRemoved += bind_weak(&IcingaApplication::DeletedComponentHandler, shared_from_this());
-
        /* register handler for 'icinga' config objects */
        ConfigCollection::Ptr icingaCollection = GetConfigHive()->GetCollection("icinga");
        function<int (const EventArgs&)> NewIcingaConfigHandler = bind_weak(&IcingaApplication::NewIcingaConfigHandler, shared_from_this());
@@ -41,6 +34,13 @@ int IcingaApplication::Main(const vector<string>& args)
        icingaCollection->ForEachObject(NewIcingaConfigHandler);
        icingaCollection->OnObjectRemoved += bind_weak(&IcingaApplication::DeletedIcingaConfigHandler, shared_from_this());
 
+       /* register handler for 'component' config objects */
+       ConfigCollection::Ptr componentCollection = GetConfigHive()->GetCollection("component");
+       function<int (const EventArgs&)> NewComponentHandler = bind_weak(&IcingaApplication::NewComponentHandler, shared_from_this());
+       componentCollection->OnObjectCreated += NewComponentHandler;
+       componentCollection->ForEachObject(NewComponentHandler);
+       componentCollection->OnObjectRemoved += bind_weak(&IcingaApplication::DeletedComponentHandler, shared_from_this());
+
        /* load config file */
        ConfigObject::Ptr fileComponentConfig = make_shared<ConfigObject>("component", "configfile");
        fileComponentConfig->SetPropertyString("configFilename", args[1]);
@@ -65,19 +65,10 @@ int IcingaApplication::Main(const vector<string>& args)
        shared_ptr<SSL_CTX> sslContext = Utility::MakeSSLContext(GetPublicKeyFile(), GetPrivateKeyFile(), GetCAKeyFile());
        m_EndpointManager->SetSSLContext(sslContext);
 
-       /* register handler for 'rpclistener' config objects */
-       ConfigCollection::Ptr listenerCollection = GetConfigHive()->GetCollection("rpclistener");
-       function<int (const EventArgs&)> NewRpcListenerHandler = bind_weak(&IcingaApplication::NewRpcListenerHandler, shared_from_this());
-       listenerCollection->OnObjectCreated += NewRpcListenerHandler;
-       listenerCollection->ForEachObject(NewRpcListenerHandler);
-       listenerCollection->OnObjectRemoved += bind_weak(&IcingaApplication::DeletedRpcListenerHandler, shared_from_this());
-
-       /* register handle for 'rpcconnection' config objects */
-       ConfigCollection::Ptr connectionCollection = GetConfigHive()->GetCollection("rpcconnection");
-       function<int (const EventArgs&)> NewRpcConnectionHandler = bind_weak(&IcingaApplication::NewRpcConnectionHandler, shared_from_this());
-       connectionCollection->OnObjectCreated += NewRpcConnectionHandler;
-       connectionCollection->ForEachObject(NewRpcConnectionHandler);
-       connectionCollection->OnObjectRemoved += bind_weak(&IcingaApplication::DeletedRpcConnectionHandler, shared_from_this());
+       /* create the primary RPC listener */
+       string service = GetService();
+       if (!service.empty())
+               GetEndpointManager()->AddListener(service);
 
        RunEventLoop();
 
@@ -164,58 +155,6 @@ int IcingaApplication::DeletedIcingaConfigHandler(const EventArgs& ea)
        return 0;
 }
 
-int IcingaApplication::NewRpcListenerHandler(const EventArgs& ea)
-{
-       ConfigObject::Ptr object = static_pointer_cast<ConfigObject>(ea.Source);
-
-       /* don't allow replicated config objects */
-       if (object->GetReplicated())
-               return 0;
-
-       string service;
-       if (!object->GetPropertyString("service", &service))
-               throw InvalidArgumentException("Parameter 'service' is required for 'rpclistener' objects.");
-
-       GetEndpointManager()->AddListener(service);
-
-       return 0;
-}
-
-int IcingaApplication::DeletedRpcListenerHandler(const EventArgs& ea)
-{
-       throw Exception("Unsupported operation.");
-
-       return 0;
-}
-
-int IcingaApplication::NewRpcConnectionHandler(const EventArgs& ea)
-{
-       ConfigObject::Ptr object = static_pointer_cast<ConfigObject>(ea.Source);
-
-       /* don't allow replicated config objects */
-       if (object->GetReplicated())
-               return 0;
-
-       string node;
-       if (!object->GetPropertyString("node", &node))
-               throw InvalidArgumentException("Parameter 'node' is required for 'rpcconnection' objects.");
-
-       string service;
-       if (!object->GetPropertyString("service", &service))
-               throw InvalidArgumentException("Parameter 'service' is required for 'rpcconnection' objects.");
-
-       GetEndpointManager()->AddConnection(node, service);
-
-       return 0;
-}
-
-int IcingaApplication::DeletedRpcConnectionHandler(const EventArgs& ea)
-{
-       throw Exception("Unsupported operation.");
-
-       return 0;
-}
-
 void IcingaApplication::SetPrivateKeyFile(string privkey)
 {
        m_PrivateKeyFile = privkey;