Implement Application::GetVersion().

Fixes #4801
This commit is contained in:
Gunnar Beutner 2013-10-09 08:46:10 +02:00
parent a3c6732adc
commit 3f922e5eac
4 changed files with 11 additions and 7 deletions

View File

@ -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";

View File

@ -32,9 +32,6 @@
#include <boost/foreach.hpp>
#ifndef _WIN32
# include "icinga-version.h"
# define ICINGA_VERSION VERSION ", " GIT_MESSAGE
# include <ltdl.h>
# include <sys/types.h>
# include <pwd.h>
@ -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 <http://gnu.org/licenses/gpl2.html>" << std::endl

View File

@ -705,3 +705,8 @@ ThreadPool& Application::GetTP(void)
static ThreadPool tp;
return tp;
}
String Application::GetVersion(void)
{
return ICINGA_VERSION;
}

View File

@ -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);