configuration is committed by the administrator. Additional information
may be provided.
-% DHCP4_CONFIG_LOAD_FAIL failed to load configuration: %1
-This critical error message indicates that the initial DHCPv4
-configuration has failed. The server will start, but nothing will be
-served until the configuration has been corrected.
+% DHCP4_CONFIG_LOAD_FAIL configuration error using file: %1, reason: %2
+This error message indicates that the DHCPv4 configuration has failed.
+If this is an initial configuration (during server's startup) the server
+will fail to start. If this is a dynamic reconfiguration attempt the
+server will continue to use an old configuration.
% DHCP4_CONFIG_NEW_SUBNET a new subnet has been added to configuration: %1
This is an informational message reporting that the configuration has
} catch (const isc::Exception& ex) {
LOG_ERROR(dhcp4_logger, DHCP4_PARSER_FAIL)
.arg(config_pair.first).arg(ex.what());
- answer = isc::config::createAnswer(1,
- string("Configuration parsing failed: ") + ex.what());
+ answer = isc::config::createAnswer(1, ex.what());
// An error occured, so make sure that we restore original data.
rollback = true;
} catch (...) {
// For things like bad_cast in boost::lexical_cast
LOG_ERROR(dhcp4_logger, DHCP4_PARSER_EXCEPTION).arg(config_pair.first);
- answer = isc::config::createAnswer(1,
- string("Configuration parsing failed"));
+ answer = isc::config::createAnswer(1, "undefined configuration"
+ " processing error");
// An error occured, so make sure that we restore original data.
rollback = true;
}
catch (const isc::Exception& ex) {
LOG_ERROR(dhcp4_logger, DHCP4_PARSER_COMMIT_FAIL).arg(ex.what());
- answer = isc::config::createAnswer(2,
- string("Configuration commit failed: ") + ex.what());
+ answer = isc::config::createAnswer(2, ex.what());
rollback = true;
} catch (...) {
// For things like bad_cast in boost::lexical_cast
LOG_ERROR(dhcp4_logger, DHCP4_PARSER_COMMIT_EXCEPTION);
- answer = isc::config::createAnswer(2,
- string("Configuration commit failed"));
+ answer = isc::config::createAnswer(2, "undefined configuration"
+ " parsing error");
rollback = true;
}
}
getConfigSummary(Configuration::CFGSEL_ALL4));
// Everything was fine. Configuration is successful.
- answer = isc::config::createAnswer(0, "Configuration committed.");
+ answer = isc::config::createAnswer(0, "Configuration successful.");
return (answer);
}
// Read contents of the file and parse it as JSON
json = isc::data::Element::fromJSONFile(file_name, true);
-
if (!json) {
- LOG_ERROR(dhcp4_logger, DHCP4_CONFIG_LOAD_FAIL)
- .arg("Config file " + file_name + " missing or empty.");
- isc_throw(isc::BadValue, "Unable to process JSON configuration"
- " file: " << file_name);
+ isc_throw(isc::BadValue, "no configuration found");
}
// Let's configure logging before applying the configuration,
// Get Dhcp4 component from the config
dhcp4 = json->get("Dhcp4");
-
if (!dhcp4) {
- LOG_ERROR(dhcp4_logger, DHCP4_CONFIG_LOAD_FAIL)
- .arg("Config file " + file_name + " does not include 'Dhcp4'"
- " entry.");
- isc_throw(isc::BadValue, "Unable to process JSON configuration"
- " file: " << file_name);
+ isc_throw(isc::BadValue, "no mandatory 'Dhcp4' entry in"
+ " the configuration");
}
// Use parsed JSON structures to configure the server
result = ControlledDhcpv4Srv::processCommand("config-reload", dhcp4);
+ if (!result) {
+ // Undetermined status of the configuration. This should never
+ // happen, but as the configureDhcp4Server returns a pointer, it is
+ // theoretically possible that it will return NULL.
+ isc_throw(isc::BadValue, "undefined result of "
+ "processCommand(\"config-reload\", dhcp4)");
+ }
- } catch (const std::exception& ex) {
- LOG_ERROR(dhcp4_logger, DHCP4_CONFIG_LOAD_FAIL).arg(ex.what());
- isc_throw(isc::BadValue, "Unable to process JSON configuration file: "
- << file_name);
- }
+ // Now check is the returned result is successful (rcode=0) or not
+ // (see @ref isc::config::parseAnswer).
+ int rcode;
+ isc::data::ConstElementPtr comment =
+ isc::config::parseAnswer(rcode, result);
+ if (rcode != 0) {
+ string reason = comment ? comment->stringValue() :
+ "no details available";
+ isc_throw(isc::BadValue, reason);
+ }
- if (!result) {
- // Undetermined status of the configuration. This should never happen,
- // but as the configureDhcp4Server returns a pointer, it is
- // theoretically possible that it will return NULL.
+ } catch (const std::exception& ex) {
LOG_ERROR(dhcp4_logger, DHCP4_CONFIG_LOAD_FAIL)
- .arg("Configuration failed: Undefined result of processCommand("
- "config-reload, " + file_name + ")");
- isc_throw(isc::BadValue, "Configuration failed: Undefined result of "
- "processCommand('config-reload', " << file_name << ")");
- }
-
- // Now check is the returned result is successful (rcode=0) or not
- isc::data::ConstElementPtr comment; /// see @ref isc::config::parseAnswer
- int rcode;
- comment = isc::config::parseAnswer(rcode, result);
- if (rcode != 0) {
- string reason = "";
- if (comment) {
- reason = comment->stringValue();
- }
- LOG_ERROR(dhcp4_logger, DHCP4_CONFIG_LOAD_FAIL).arg(reason);
- isc_throw(isc::BadValue, "Failed to apply configuration: " << reason);
+ .arg(file_name).arg(ex.what());
+ isc_throw(isc::BadValue, "configuration error using file '"
+ << file_name << "': " << ex.what());
}
}
configuration is committed by the administrator. Additional information
may be provided.
-% DHCP6_CONFIG_LOAD_FAIL failed to load configuration: %1
-This critical error message indicates that the initial DHCPv6
-configuration has failed. The server will start, but nothing will be
-served until the configuration has been corrected.
+% DHCP6_CONFIG_LOAD_FAIL configuration error using file: %1, reason: %2
+This error message indicates that the DHCPv6 configuration has failed.
+If this is an initial configuration (during server's startup) the server
+will fail to start. If this is a dynamic reconfiguration attempt the
+server will continue to use an old configuration.
% DHCP6_CONFIG_NEW_SUBNET a new subnet has been added to configuration: %1
This is an informational message reporting that the configuration has
} catch (const isc::Exception& ex) {
LOG_ERROR(dhcp6_logger, DHCP6_PARSER_FAIL)
.arg(config_pair.first).arg(ex.what());
- answer = isc::config::createAnswer(1,
- string("Configuration parsing failed: ") + ex.what());
+ answer = isc::config::createAnswer(1, ex.what());
// An error occured, so make sure that we restore original data.
rollback = true;
} catch (...) {
// for things like bad_cast in boost::lexical_cast
LOG_ERROR(dhcp6_logger, DHCP6_PARSER_EXCEPTION).arg(config_pair.first);
- answer = isc::config::createAnswer(1,
- string("Configuration parsing failed"));
+ answer = isc::config::createAnswer(1, "undefined configuration"
+ " processing error");
// An error occured, so make sure that we restore original data.
rollback = true;
}
}
catch (const isc::Exception& ex) {
LOG_ERROR(dhcp6_logger, DHCP6_PARSER_COMMIT_FAIL).arg(ex.what());
- answer = isc::config::createAnswer(2,
- string("Configuration commit failed:") + ex.what());
+ answer = isc::config::createAnswer(2, ex.what());
// An error occured, so make sure to restore the original data.
rollback = true;
} catch (...) {
// for things like bad_cast in boost::lexical_cast
LOG_ERROR(dhcp6_logger, DHCP6_PARSER_COMMIT_EXCEPTION);
- answer = isc::config::createAnswer(2,
- string("Configuration commit failed"));
+ answer = isc::config::createAnswer(2, "undefined configuration"
+ " parsing error");
// An error occured, so make sure to restore the original data.
rollback = true;
}
getConfigSummary(Configuration::CFGSEL_ALL6));
// Everything was fine. Configuration is successful.
- answer = isc::config::createAnswer(0, "Configuration committed.");
+ answer = isc::config::createAnswer(0, "Configuration successful.");
return (answer);
}
// Read contents of the file and parse it as JSON
json = isc::data::Element::fromJSONFile(file_name, true);
-
if (!json) {
- LOG_ERROR(dhcp6_logger, DHCP6_CONFIG_LOAD_FAIL)
- .arg("Config file " + file_name + " missing or empty.");
- isc_throw(isc::BadValue, "Unable to process JSON configuration file:"
- + file_name);
+ isc_throw(isc::BadValue, "no configuration found");
}
// Let's configure logging before applying the configuration,
dhcp6 = json->get("Dhcp6");
if (!dhcp6) {
- LOG_ERROR(dhcp6_logger, DHCP6_CONFIG_LOAD_FAIL)
- .arg("Config file " + file_name + " does not include 'Dhcp6' entry.");
- isc_throw(isc::BadValue, "Unable to process JSON configuration file:"
- + file_name);
+ isc_throw(isc::BadValue, "no mandatory 'Dhcp6' entry in"
+ " the configuration");
}
// Use parsed JSON structures to configure the server
result = ControlledDhcpv6Srv::processCommand("config-reload", dhcp6);
+ if (!result) {
+ // Undetermined status of the configuration. This should never
+ // happen, but as the configureDhcp6Server returns a pointer, it is
+ // theoretically possible that it will return NULL.
+ isc_throw(isc::BadValue, "undefined result of "
+ "processCommand(\"config-reload\", dhcp6)");
+ }
- } catch (const std::exception& ex) {
- LOG_ERROR(dhcp6_logger, DHCP6_CONFIG_LOAD_FAIL).arg(ex.what());
- isc_throw(isc::BadValue, "Unable to process JSON configuration file:"
- + file_name);
- }
+ // Now check is the returned result is successful (rcode=0) or not
+ // (see @ref isc::config::parseAnswer).
+ int rcode;
+ isc::data::ConstElementPtr comment =
+ isc::config::parseAnswer(rcode, result);
+ if (rcode != 0) {
+ string reason = comment ? comment->stringValue() :
+ "no details available";
+ isc_throw(isc::BadValue, reason);
+ }
- if (!result) {
- // Undetermined status of the configuration. This should never happen,
- // but as the configureDhcp6Server returns a pointer, it is theoretically
- // possible that it will return NULL.
+ } catch (const std::exception& ex) {
LOG_ERROR(dhcp6_logger, DHCP6_CONFIG_LOAD_FAIL)
- .arg("Configuration failed: Undefined result of configureDhcp6Server"
- "() function after attempting to read " + file_name);
- return;
+ .arg(file_name).arg(ex.what());
+ isc_throw(isc::BadValue, "configuration error using file '"
+ << file_name << "': " << ex.what());
}
- // Now check is the returned result is successful (rcode=0) or not
- isc::data::ConstElementPtr comment; /// see @ref isc::config::parseAnswer
- int rcode;
- comment = isc::config::parseAnswer(rcode, result);
- if (rcode != 0) {
- string reason = "";
- if (comment) {
- reason = comment->stringValue();
- }
- LOG_ERROR(dhcp6_logger, DHCP6_CONFIG_LOAD_FAIL).arg(reason);
- isc_throw(isc::BadValue, "Failed to apply configuration:" << reason);
- }
}
/// @brief Signals handler for DHCPv6 server.
if (!infile.is_open())
{
const char* error = strerror(errno);
- isc_throw(InvalidOperation, "Failed to read file '" << file_name
- << "', error:" << error);
+ isc_throw(InvalidOperation, "failed to read file '" << file_name
+ << "': " << error);
}
return (fromJSON(infile, file_name, preproc));