Commit dc69d955 authored by Marcin Siodelski's avatar Marcin Siodelski
Browse files

[3409] Append line number to error caused by undefined global parameter.

parent 5c31704c
...@@ -414,7 +414,8 @@ namespace dhcp { ...@@ -414,7 +414,8 @@ namespace dhcp {
/// @return parser for specified global DHCPv4 parameter /// @return parser for specified global DHCPv4 parameter
/// @throw NotImplemented if trying to create a parser for unknown /// @throw NotImplemented if trying to create a parser for unknown
/// config element /// config element
DhcpConfigParser* createGlobalDhcp4ConfigParser(const std::string& config_id) { DhcpConfigParser* createGlobalDhcp4ConfigParser(const std::string& config_id,
ConstElementPtr element) {
DhcpConfigParser* parser = NULL; DhcpConfigParser* parser = NULL;
if ((config_id.compare("valid-lifetime") == 0) || if ((config_id.compare("valid-lifetime") == 0) ||
(config_id.compare("renew-timer") == 0) || (config_id.compare("renew-timer") == 0) ||
...@@ -445,9 +446,9 @@ DhcpConfigParser* createGlobalDhcp4ConfigParser(const std::string& config_id) { ...@@ -445,9 +446,9 @@ DhcpConfigParser* createGlobalDhcp4ConfigParser(const std::string& config_id) {
} else if (config_id.compare("dhcp-ddns") == 0) { } else if (config_id.compare("dhcp-ddns") == 0) {
parser = new D2ClientConfigParser(config_id); parser = new D2ClientConfigParser(config_id);
} else { } else {
isc_throw(NotImplemented, isc_throw(DhcpConfigError,
"Parser error: Global configuration parameter not supported: " "unsupported global configuration parameter: "
<< config_id); << config_id << " (" << element->getPosition() << ")");
} }
return (parser); return (parser);
...@@ -525,7 +526,8 @@ configureDhcp4Server(Dhcpv4Srv&, isc::data::ConstElementPtr config_set) { ...@@ -525,7 +526,8 @@ configureDhcp4Server(Dhcpv4Srv&, isc::data::ConstElementPtr config_set) {
const std::map<std::string, ConstElementPtr>& values_map = const std::map<std::string, ConstElementPtr>& values_map =
config_set->mapValue(); config_set->mapValue();
BOOST_FOREACH(config_pair, values_map) { BOOST_FOREACH(config_pair, values_map) {
ParserPtr parser(createGlobalDhcp4ConfigParser(config_pair.first)); ParserPtr parser(createGlobalDhcp4ConfigParser(config_pair.first,
config_pair.second));
LOG_DEBUG(dhcp4_logger, DBG_DHCP4_DETAIL, DHCP4_PARSER_CREATED) LOG_DEBUG(dhcp4_logger, DBG_DHCP4_DETAIL, DHCP4_PARSER_CREATED)
.arg(config_pair.first); .arg(config_pair.first);
if (config_pair.first == "subnet4") { if (config_pair.first == "subnet4") {
......
...@@ -640,7 +640,8 @@ namespace dhcp { ...@@ -640,7 +640,8 @@ namespace dhcp {
/// @return parser for specified global DHCPv6 parameter /// @return parser for specified global DHCPv6 parameter
/// @throw NotImplemented if trying to create a parser for unknown config /// @throw NotImplemented if trying to create a parser for unknown config
/// element /// element
DhcpConfigParser* createGlobal6DhcpConfigParser(const std::string& config_id) { DhcpConfigParser* createGlobal6DhcpConfigParser(const std::string& config_id,
ConstElementPtr element) {
DhcpConfigParser* parser = NULL; DhcpConfigParser* parser = NULL;
if ((config_id.compare("preferred-lifetime") == 0) || if ((config_id.compare("preferred-lifetime") == 0) ||
(config_id.compare("valid-lifetime") == 0) || (config_id.compare("valid-lifetime") == 0) ||
...@@ -669,9 +670,9 @@ DhcpConfigParser* createGlobal6DhcpConfigParser(const std::string& config_id) { ...@@ -669,9 +670,9 @@ DhcpConfigParser* createGlobal6DhcpConfigParser(const std::string& config_id) {
} else if (config_id.compare("dhcp-ddns") == 0) { } else if (config_id.compare("dhcp-ddns") == 0) {
parser = new D2ClientConfigParser(config_id); parser = new D2ClientConfigParser(config_id);
} else { } else {
isc_throw(NotImplemented, isc_throw(DhcpConfigError,
"Parser error: Global configuration parameter not supported: " "unsupported global configuration parameter: "
<< config_id); << config_id << " (" << element->getPosition() << ")");
} }
return (parser); return (parser);
...@@ -736,7 +737,8 @@ configureDhcp6Server(Dhcpv6Srv&, isc::data::ConstElementPtr config_set) { ...@@ -736,7 +737,8 @@ configureDhcp6Server(Dhcpv6Srv&, isc::data::ConstElementPtr config_set) {
const std::map<std::string, ConstElementPtr>& values_map = const std::map<std::string, ConstElementPtr>& values_map =
config_set->mapValue(); config_set->mapValue();
BOOST_FOREACH(config_pair, values_map) { BOOST_FOREACH(config_pair, values_map) {
ParserPtr parser(createGlobal6DhcpConfigParser(config_pair.first)); ParserPtr parser(createGlobal6DhcpConfigParser(config_pair.first,
config_pair.second));
LOG_DEBUG(dhcp6_logger, DBG_DHCP6_DETAIL, DHCP6_PARSER_CREATED) LOG_DEBUG(dhcp6_logger, DBG_DHCP6_DETAIL, DHCP6_PARSER_CREATED)
.arg(config_pair.first); .arg(config_pair.first);
if (config_pair.first == "subnet6") { if (config_pair.first == "subnet6") {
......
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