From 3f922e5eac849394429587ba635a8e601bf1575d Mon Sep 17 00:00:00 2001 From: Gunnar Beutner Date: Wed, 9 Oct 2013 08:46:10 +0200 Subject: [PATCH] Implement Application::GetVersion(). Fixes #4801 --- components/compat/statusdatawriter.cpp | 2 +- icinga-app/icinga.cpp | 7 +------ lib/base/application.cpp | 5 +++++ lib/base/application.h | 4 ++++ 4 files changed, 11 insertions(+), 7 deletions(-) diff --git a/components/compat/statusdatawriter.cpp b/components/compat/statusdatawriter.cpp index 3fb34b259..cd1315a5e 100644 --- a/components/compat/statusdatawriter.cpp +++ b/components/compat/statusdatawriter.cpp @@ -608,7 +608,7 @@ void StatusDataWriter::StatusTimerHandler(void) statusfp << "info {" << "\n" << "\t" << "created=" << Utility::GetTime() << "\n" - << "\t" << "version=2.0" << "\n" + << "\t" << "version=" << Application::GetVersion() << "\n" << "\t" << "}" << "\n" << "\n"; diff --git a/icinga-app/icinga.cpp b/icinga-app/icinga.cpp index f8b666252..0dc9acfcd 100644 --- a/icinga-app/icinga.cpp +++ b/icinga-app/icinga.cpp @@ -32,9 +32,6 @@ #include #ifndef _WIN32 -# include "icinga-version.h" -# define ICINGA_VERSION VERSION ", " GIT_MESSAGE - # include # include # include @@ -290,9 +287,7 @@ int main(int argc, char **argv) std::cout << appName << " " << "- The Icinga 2 network monitoring daemon."; if (g_AppParams.count("version")) { -#ifndef _WIN32 - std::cout << " (Version: " << ICINGA_VERSION << ")"; -#endif /* _WIN32 */ + std::cout << " (Version: " << Application::GetVersion() << ")"; std::cout << std::endl << "Copyright (c) 2012-2013 Icinga Development Team (http://www.icinga.org)" << std::endl << "License GPLv2+: GNU GPL version 2 or later " << std::endl diff --git a/lib/base/application.cpp b/lib/base/application.cpp index 7bd943e7c..3ba47522a 100644 --- a/lib/base/application.cpp +++ b/lib/base/application.cpp @@ -705,3 +705,8 @@ ThreadPool& Application::GetTP(void) static ThreadPool tp; return tp; } + +String Application::GetVersion(void) +{ + return ICINGA_VERSION; +} diff --git a/lib/base/application.h b/lib/base/application.h index b8ec5c73d..878fd3aa9 100644 --- a/lib/base/application.h +++ b/lib/base/application.h @@ -23,6 +23,8 @@ #include "base/i2-base.h" #include "base/threadpool.h" #include "base/dynamicobject.h" +#include "icinga-version.h" +#define ICINGA_VERSION VERSION ", " GIT_MESSAGE namespace icinga { @@ -92,6 +94,8 @@ public: static ThreadPool& GetTP(void); + static String GetVersion(void); + protected: virtual void OnConfigLoaded(void); virtual void Stop(void); -- 2.40.0