Commit 3f46c74f authored by Tomek Mrugalski's avatar Tomek Mrugalski 🛰
Browse files

[3508] Changes after review

 - Daemon::getVersion() added
 - exists => exits in docs
 - fixed comment in dhcp_test_lib.sh.in
parent 4837a87b
......@@ -82,13 +82,13 @@
</listitem>
<listitem>
<simpara>
<command>-v</command> - prints out Kea version and exists.
<command>-v</command> - prints out Kea version and exits.
</simpara>
</listitem>
<listitem>
<simpara>
<command>-V</command> - prints out Kea extended version with
additional parameters and exists.
additional parameters and exits.
</simpara>
</listitem>
</itemizedlist>
......
......@@ -46,13 +46,13 @@
</listitem>
<listitem>
<simpara>
<command>-v</command> - prints out Kea version and exists.
<command>-v</command> - prints out Kea version and exits.
</simpara>
</listitem>
<listitem>
<simpara>
<command>-V</command> - prints out Kea extended version with
additional parameters and exists.
additional parameters and exits.
</simpara>
</listitem>
</itemizedlist>
......
......@@ -44,13 +44,13 @@
</listitem>
<listitem>
<simpara>
<command>-v</command> - prints out Kea version and exists.
<command>-v</command> - prints out Kea version and exits.
</simpara>
</listitem>
<listitem>
<simpara>
<command>-V</command> - prints out Kea extended version with
additional parameters and exists.
additional parameters and exits.
</simpara>
</listitem>
</itemizedlist>
......
......@@ -124,20 +124,6 @@ DControllerBase::launch(int argc, char* argv[], const bool test_mode) {
LOG_INFO(dctl_logger, DHCP_DDNS_SHUTDOWN);
}
void
DControllerBase::printVersion(bool extended) const {
std::cout << VERSION << std::endl;
if (extended) {
std::cout << EXTENDED_VERSION << std::endl;
// @todo print more details (is it Botan or OpenSSL build,
// with or without MySQL/Postgres? What compilation options were
// used? etc)
}
exit(EXIT_SUCCESS);
}
void
DControllerBase::parseArgs(int argc, char* argv[])
{
......@@ -156,12 +142,14 @@ DControllerBase::parseArgs(int argc, char* argv[])
break;
case 'v':
printVersion(false); // print just Kea version and exit
break; // break not really needed, print_version never returns
// Print just Kea version and exit
std::cout << getVersion(false) << std::endl;
exit(EXIT_SUCCESS);
case 'V':
printVersion(true); // print extended Kea version and exit
break; // break not really needed, print_version never returns
// Print extended Kea version and exit
std::cout << getVersion(true) << std::endl;
exit(EXIT_SUCCESS);
case 'c':
// config file name
......@@ -448,3 +436,19 @@ dhcp::Daemon::loggerInit(const char* log_name, bool verbose) {
}
}; // namespace isc
std::string
isc::dhcp::Daemon::getVersion(bool extended) {
std::stringstream tmp;
tmp << VERSION;
if (extended) {
tmp << std::endl << EXTENDED_VERSION;
// @todo print more details (is it Botan or OpenSSL build,
// with or without MySQL/Postgres? What compilation options were
// used? etc)
}
return (tmp.str());
}
......@@ -457,12 +457,6 @@ protected:
/// This is intended to be used for specific usage violation messages.
void usage(const std::string& text);
/// @brief Prints version number to stdout and exit.
///
/// Note: This method never returns, it terminates the process.
/// @param extended print additional information?
void printVersion(bool extended) const;
private:
/// @brief Name of the service under control.
/// This name is used as the configuration module name and appears in log
......
......@@ -2032,5 +2032,21 @@ Dhcpv4Srv::d2ClientErrorHandler(const
CfgMgr::instance().getD2ClientMgr().suspendUpdates();
}
std::string
Daemon::getVersion(bool extended) {
std::stringstream tmp;
tmp << VERSION;
if (extended) {
tmp << endl << EXTENDED_VERSION;
// @todo print more details (is it Botan or OpenSSL build,
// with or without MySQL/Postgres? What compilation options were
// used? etc)
}
return (tmp.str());
}
} // namespace dhcp
} // namespace isc
......@@ -60,24 +60,6 @@ usage() {
}
} // end of anonymous namespace
/// @brief Prints Kea version on stdout and exits.
///
/// Note: This function never returns. It terminates the process.
/// @param extended print additional information?
void
printVersion(bool extended) {
cout << VERSION << endl;
if (extended) {
cout << EXTENDED_VERSION << endl;
// @todo print more details (is it Botan or OpenSSL build,
// with or without MySQL/Postgres? What compilation options were
// used? etc)
}
exit(EXIT_SUCCESS);
}
int
main(int argc, char* argv[]) {
int ch;
......@@ -95,12 +77,12 @@ main(int argc, char* argv[]) {
break;
case 'v':
printVersion(false); // print just Kea version and exit
break; // break not really needed, print_version never returns
cout << Daemon::getVersion(false) << endl;
return (EXIT_SUCCESS);
case 'V':
printVersion(true); // print extended Kea version and exit
break; // break not really needed, print_version never returns
cout << Daemon::getVersion(false) << endl;
return (EXIT_SUCCESS);
case 'p':
try {
......
......@@ -2692,5 +2692,21 @@ Dhcpv6Srv::d2ClientErrorHandler(const
CfgMgr::instance().getD2ClientMgr().suspendUpdates();
}
std::string
Daemon::getVersion(bool extended) {
std::stringstream tmp;
tmp << VERSION;
if (extended) {
tmp << endl << EXTENDED_VERSION;
// @todo print more details (is it Botan or OpenSSL build,
// with or without MySQL/Postgres? What compilation options were
// used? etc)
}
return (tmp.str());
}
};
};
......@@ -60,24 +60,6 @@ usage() {
}
} // end of anonymous namespace
/// @brief Prints Kea version on stdout and exits.
///
/// Note: This function never returns. It terminates the process.
/// @param extended print additional information?
void
printVersion(bool extended) {
cout << VERSION << endl;
if (extended) {
cout << EXTENDED_VERSION << endl;
// @todo print more details (is it Botan or OpenSSL build,
// with or without MySQL/Postgres? What compilation options were
// used? etc)
}
exit(EXIT_SUCCESS);
}
int
main(int argc, char* argv[]) {
int ch;
......@@ -95,12 +77,12 @@ main(int argc, char* argv[]) {
break;
case 'v':
printVersion(false); // print just Kea version and exit
break; // break not really needed, print_version never returns
cout << Daemon::getVersion(false) << endl;
return (EXIT_SUCCESS);
case 'V':
printVersion(true); // print extended Kea version and exit
break; // break not really needed, print_version never returns
cout << Daemon::getVersion(true) << endl;
return (EXIT_SUCCESS);
case 'p': // port number
try {
......
......@@ -151,6 +151,17 @@ public:
return (verbose_);
}
/// @brief returns Kea version on stdout and exits.
///
/// With extended == false, this method returns a simple string
/// containing version number. With extended == true, it returns
/// also additional information about sources. It is expected to
/// return extra information about dependencies and used DB backends.
///
/// @param extended print additional information?
/// @return text string
static std::string getVersion(bool extended);
protected:
/// @brief Invokes handler for the next received signal.
......
......@@ -23,8 +23,17 @@ using namespace isc;
using namespace isc::dhcp;
using namespace isc::data;
std::string isc::dhcp::Daemon::getVersion(bool extended) {
if (extended) {
return (std::string("EXTENDED"));
} else {
return (std::string("BASIC"));
}
}
namespace {
// Very simple test. Checks whether Daemon can be instantiated and its
// default parameters are sane
TEST(DaemonTest, constructor) {
......
......@@ -402,7 +402,7 @@ must be a number"
kill -${sig} ${_GET_PIDS}
}
# This test verifies that DHCPv4 server is reporting its version properly.
# This test verifies that the binary is reporting its version properly.
version_test() {
test_name=${1} # Test name
......
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