Commit 650110ab authored by Thomas Markwalder's avatar Thomas Markwalder
Browse files

[5211] libkea-process is no longer dependent on cryptolink

DControllerBase was modified to support a means for derivations to
contribute additional information to extended version info returned
by DControllerBase::getVersion(true).  This removes the need to link
process lib with libraries it does not need.

src/bin/d2/d2_controller.h
src/bin/d2/d2_controller.cc
    D2Controller::getVersionAddendum() - new method which reports
    D2 dependencies (currently only cryptolink)

src/lib/process/Makefile.am
    Removed temporary link to cryptolink

src/lib/process/d_controller.h
src/lib/process/d_controller.cc
    DControllerBase::getVersionAddendum() - new virtual method so
    derivations can contribute to extended version information

    DControllerBase::getVersion(bool extended) - modified to call
    getVersionAddendum(), removed explict calls for crypto and
    RDBMs versions

Added unit test support
parent 939fdced
......@@ -72,5 +72,14 @@ D2Controller::parseFile(const std::string& file_name) {
D2Controller::~D2Controller() {
}
std::string
D2Controller::getVersionAddendum() {
std::stringstream stream;
// Currently the only dependency D2 adds to base is cryptolink
stream << isc::cryptolink::CryptoLink::getVersion() << std::endl;
return (stream.str());
}
}; // end namespace isc::d2
}; // end namespace isc
......@@ -42,6 +42,10 @@ public:
/// by convention this should match the executable name.
static const char* d2_bin_name_;
protected:
/// @brief Returns version info specific to D2
virtual std::string getVersionAddendum();
private:
/// @brief Creates an instance of the DHCP-DDNS specific application
/// process. This method is invoked during the process initialization
......
......@@ -57,11 +57,10 @@ libkea_process_la_LIBADD += $(top_builddir)/src/lib/dhcp/libkea-dhcp++.la
libkea_process_la_LIBADD += $(top_builddir)/src/lib/asiolink/libkea-asiolink.la
libkea_process_la_LIBADD += $(top_builddir)/src/lib/cc/libkea-cc.la
libkea_process_la_LIBADD += $(top_builddir)/src/lib/hooks/libkea-hooks.la
libkea_process_la_LIBADD += $(top_builddir)/src/lib/cryptolink/libkea-cryptolink.la
libkea_process_la_LIBADD += $(top_builddir)/src/lib/log/libkea-log.la
libkea_process_la_LIBADD += $(top_builddir)/src/lib/util/libkea-util.la
libkea_process_la_LIBADD += $(top_builddir)/src/lib/exceptions/libkea-exceptions.la
libkea_process_la_LIBADD += $(LOG4CPLUS_LIBS) $(CRYPTO_LIBS) $(BOOST_LIBS)
libkea_process_la_LIBADD += $(LOG4CPLUS_LIBS) $(BOOST_LIBS)
# Specify the headers for copying into the installation directory tree.
libkea_process_includedir = $(pkgincludedir)/process
......
......@@ -7,7 +7,6 @@
#include <config.h>
#include <cc/command_interpreter.h>
#include <cfgrpt/config_report.h>
#include <cryptolink/cryptolink.h>
#include <dhcpsrv/cfgmgr.h>
#include <exceptions/exceptions.h>
#include <log/logger.h>
......@@ -674,20 +673,7 @@ DControllerBase::getVersion(bool extended) {
tmp << std::endl << EXTENDED_VERSION << std::endl;
tmp << "linked with:" << std::endl;
tmp << isc::log::Logger::getVersion() << std::endl;
tmp << isc::cryptolink::CryptoLink::getVersion() << std::endl;
tmp << "database:" << std::endl;
#ifdef HAVE_MYSQL
tmp << isc::dhcp::MySqlLeaseMgr::getDBVersion() << std::endl;
#endif
#ifdef HAVE_PGSQL
tmp << isc::dhcp::PgSqlLeaseMgr::getDBVersion() << std::endl;
#endif
#ifdef HAVE_CQL
tmp << isc::dhcp::CqlLeaseMgr::getDBVersion() << std::endl;
#endif
tmp << isc::dhcp::Memfile_LeaseMgr::getDBVersion();
// @todo: more details about database runtime
tmp << getVersionAddendum();
}
return (tmp.str());
......
......@@ -115,7 +115,7 @@ public:
/// @brief returns Kea version on stdout and exit.
/// redeclaration/redefinition. @ref isc::dhcp::Daemon::getVersion()
static std::string getVersion(bool extended);
std::string getVersion(bool extended);
/// @brief Acts as the primary entry point into the controller execution
/// and provides the outermost application control logic:
......@@ -587,6 +587,15 @@ protected:
/// This is intended to be used for specific usage violation messages.
void usage(const std::string& text);
/// @brief Fetches text containing additional version specifics
///
/// This method is provided so derivations can append any additional
/// desired information such as library dependencies to the extended
/// version text returned when DControllerBase::getVersion(true) is
/// invoked.
/// @return a string containing additonal version info
virtual std::string getVersionAddendum() { return (""); }
private:
/// @brief Name of the service under control.
/// This name is used as the configuration module name and appears in log
......
......@@ -418,6 +418,17 @@ TEST_F(DStubControllerTest, sigintShutdown) {
EXPECT_TRUE(elapsed_time.total_milliseconds() < 300);
}
// Verifies that version and extended version information is correct
TEST_F(DStubControllerTest, getVersion) {
std::string text = controller_->getVersion(false);
EXPECT_EQ(text,VERSION);
text = controller_->getVersion(true);
EXPECT_NE(std::string::npos, text.find(VERSION));
EXPECT_NE(std::string::npos, text.find(EXTENDED_VERSION));
EXPECT_NE(std::string::npos, text.find(controller_->getVersionAddendum()));
}
// Tests that the SIGTERM triggers a normal shutdown.
TEST_F(DStubControllerTest, sigtermShutdown) {
// Setup to raise SIGHUP in 1 ms.
......
......@@ -275,6 +275,17 @@ protected:
/// otherwise it return an empty pointer.
virtual isc::data::ConstElementPtr parseFile(const std::string&);
public:
/// @brief Provides addtional extended version text
///
/// Overrides the base class implementation so we can
/// verify the getting the extended version text
/// contains derivaiton specific contributions.
virtual std::string getVersionAddendum() {
return ("StubController Version Text");
}
private:
/// @brief Constructor is private to protect singleton integrity.
DStubController();
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment