2
0
mirror of https://gitlab.isc.org/isc-projects/kea synced 2025-08-22 09:57:41 +00:00

[#3831] Checkpoint: fixes

This commit is contained in:
Francis Dupont 2025-05-15 21:01:23 +02:00
parent 01dc6e538c
commit e8d9560f43
5 changed files with 16 additions and 10 deletions

View File

@ -828,6 +828,9 @@ TEST_F(CtrlAgentControllerTest, configWrite) {
// Now clean up after ourselves.
ctrl->registerCommands();
// Add a config file.
ctrl->setConfigFile(string(TEST_DATA_BUILDDIR) + string("/config.json"));
// First, build the command:
string file = string(TEST_DATA_BUILDDIR) + string("/config-write.json");
string cmd_txt = "{ \"command\": \"config-write\" }";

View File

@ -298,9 +298,10 @@ ControlledDhcpv4Srv::commandConfigWriteHandler(const string&,
try {
checkWriteConfigFile(filename);
} catch (const isc::Exception& ex) {
return (createAnswer(CONTROL_RESULT_ERROR,
string("not allowed to write config into ") +
filename));
std::ostringstream msg;
msg << "not allowed to write config into " << filename
<< ": " << ex.what();
return (createAnswer(CONTROL_RESULT_ERROR, msg.str()));
}
}

View File

@ -301,9 +301,10 @@ ControlledDhcpv6Srv::commandConfigWriteHandler(const string&,
try {
checkWriteConfigFile(filename);
} catch (const isc::Exception& ex) {
return (createAnswer(CONTROL_RESULT_ERROR,
string("not allowed to write config into ") +
filename));
std::ostringstream msg;
msg << "not allowed to write config into " << filename
<< ": " << ex.what();
return (createAnswer(CONTROL_RESULT_ERROR, msg.str()));
}
}

View File

@ -512,9 +512,10 @@ DControllerBase::configWriteHandler(const std::string&,
try {
checkWriteConfigFile(filename);
} catch (const isc::Exception& ex) {
return (createAnswer(CONTROL_RESULT_ERROR,
std::string("not allowed to write config into ") +
filename));
std::ostringstream msg;
msg << "not allowed to write config into " << filename
<< ": " << ex.what();
return (createAnswer(CONTROL_RESULT_ERROR, msg.str()));
}
}

View File

@ -144,7 +144,7 @@ Daemon::checkWriteConfigFile(std::string& file) {
return;
}
isc_throw(isc::BadValue, "file " << file << " must be in the same "
<< "directory as the config file (" << config_file_ << "'");
<< "directory as the config file (" << config_file_ << ")");
}
std::string