[icinga-checkins] icinga.org: icinga2/support/2.5: Make sure that libmethods is automatically loaded even when not using the ITL

git at icinga.org git at icinga.org
Mon Aug 29 12:22:52 CEST 2016


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

Author: Gunnar Beutner <gunnar.beutner at netways.de>
Date:   Sun Aug 28 17:03:08 2016 +0200

Make sure that libmethods is automatically loaded even when not using the ITL

fixes #12578

---

 doc/10-icinga-template-library.md |    5 -----
 itl/CMakeLists.txt                |    2 +-
 itl/command.conf                  |   20 --------------------
 itl/itl                           |    1 -
 lib/icinga/icingaapplication.cpp  |    3 +++
 test/livestatus-test.cpp          |    1 +
 6 files changed, 5 insertions(+), 27 deletions(-)

diff --git a/doc/10-icinga-template-library.md b/doc/10-icinga-template-library.md
index 5195745..9d58271 100644
--- a/doc/10-icinga-template-library.md
+++ b/doc/10-icinga-template-library.md
@@ -16,11 +16,6 @@ These templates are imported by the provided example configuration.
 > These templates are built into the binaries. By convention
 > all command and timeperiod objects should import these templates.
 
-If you're not using the ITL includes you can manually load the
-library which contains these templates:
-
-    library "methods"
-
 ### <a id="itl-plugin-check-command"></a> plugin-check-command
 
 Command template for check plugins executed by Icinga 2.
diff --git a/itl/CMakeLists.txt b/itl/CMakeLists.txt
index 7f12eb0..934195f 100644
--- a/itl/CMakeLists.txt
+++ b/itl/CMakeLists.txt
@@ -18,6 +18,6 @@
 add_subdirectory(plugins-contrib.d)
 
 install(
-  FILES itl command.conf command-icinga.conf hangman plugins command-plugins.conf manubulon command-plugins-manubulon.conf windows-plugins command-plugins-windows.conf nscp command-nscp-local.conf plugins-contrib
+  FILES itl command-icinga.conf hangman plugins command-plugins.conf manubulon command-plugins-manubulon.conf windows-plugins command-plugins-windows.conf nscp command-nscp-local.conf plugins-contrib
   DESTINATION ${CMAKE_INSTALL_DATADIR}/icinga2/include
 )
diff --git a/itl/command.conf b/itl/command.conf
deleted file mode 100644
index 3a9d917..0000000
--- a/itl/command.conf
+++ /dev/null
@@ -1,20 +0,0 @@
-/******************************************************************************
- * Icinga 2                                                                   *
- * Copyright (C) 2012-2016 Icinga Development Team (https://www.icinga.org/)  *
- *                                                                            *
- * This program is free software; you can redistribute it and/or              *
- * modify it under the terms of the GNU General Public License                *
- * as published by the Free Software Foundation; either version 2             *
- * of the License, or (at your option) any later version.                     *
- *                                                                            *
- * This program is distributed in the hope that it will be useful,            *
- * but WITHOUT ANY WARRANTY; without even the implied warranty of             *
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the              *
- * GNU General Public License for more details.                               *
- *                                                                            *
- * You should have received a copy of the GNU General Public License          *
- * along with this program; if not, write to the Free Software Foundation     *
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.             *
- ******************************************************************************/
-
-library "methods"
diff --git a/itl/itl b/itl/itl
index dead0bb..ad8fbe0 100644
--- a/itl/itl
+++ b/itl/itl
@@ -22,5 +22,4 @@
  * configuration templates.
  */
 
-include "command.conf"
 include "command-icinga.conf"
diff --git a/lib/icinga/icingaapplication.cpp b/lib/icinga/icingaapplication.cpp
index 1b7e99c..179df0b 100644
--- a/lib/icinga/icingaapplication.cpp
+++ b/lib/icinga/icingaapplication.cpp
@@ -33,6 +33,7 @@
 #include "base/scriptglobal.hpp"
 #include "base/initialize.hpp"
 #include "base/statsfunction.hpp"
+#include "base/loader.hpp"
 
 using namespace icinga;
 
@@ -43,6 +44,8 @@ INITIALIZE_ONCE(&IcingaApplication::StaticInitialize);
 
 void IcingaApplication::StaticInitialize(void)
 {
+	Loader::LoadExtensionLibrary("methods");
+
 	String node_name = Utility::GetFQDN();
 
 	if (node_name.IsEmpty()) {
diff --git a/test/livestatus-test.cpp b/test/livestatus-test.cpp
index 66ee617..a6c2551 100644
--- a/test/livestatus-test.cpp
+++ b/test/livestatus-test.cpp
@@ -45,6 +45,7 @@ struct LivestatusFixture
 		std::ofstream cfgfp;
 		cfgfp.open(cfg_file_path_tmp.CStr(), std::ofstream::out | std::ofstream::trunc);
 		cfgfp << std::fixed;
+		cfgfp << "library \"methods\"\n";
 		cfgfp << "object CheckCommand \"dummy\" {\n";
 		cfgfp << "  import \"plugin-check-command\"\n";
 		cfgfp << "  command = \"/bin/echo\"\n";



More information about the icinga-checkins mailing list