diff options
author | Razvan Becheriu <razvan@isc.org> | 2023-02-26 16:23:40 +0100 |
---|---|---|
committer | Razvan Becheriu <razvan@isc.org> | 2023-03-16 20:26:11 +0100 |
commit | db352cc04cf99e5b877d02f87eaa8dbe2bc82f10 (patch) | |
tree | f711d6316cebe9b2e0c37bd46ecf7efea0488c6f /src/lib/process | |
parent | [#2722] always perform config check before config set (diff) | |
download | kea-db352cc04cf99e5b877d02f87eaa8dbe2bc82f10.tar.xz kea-db352cc04cf99e5b877d02f87eaa8dbe2bc82f10.zip |
[#2722] config set follows the same path as config test and can rollback
Diffstat (limited to 'src/lib/process')
-rw-r--r-- | src/lib/process/d_cfg_mgr.cc | 9 | ||||
-rw-r--r-- | src/lib/process/testutils/d_test_stubs.cc | 10 |
2 files changed, 11 insertions, 8 deletions
diff --git a/src/lib/process/d_cfg_mgr.cc b/src/lib/process/d_cfg_mgr.cc index 4a67183128..5ee15ec7fb 100644 --- a/src/lib/process/d_cfg_mgr.cc +++ b/src/lib/process/d_cfg_mgr.cc @@ -26,6 +26,7 @@ using namespace std; using namespace isc; +using namespace isc::config; using namespace isc::dhcp; using namespace isc::data; using namespace isc::asiolink; @@ -76,8 +77,8 @@ DCfgMgrBase::simpleParseConfig(isc::data::ConstElementPtr config_set, bool check_only, const std::function<void()>& post_config_cb) { if (!config_set) { - return (isc::config::createAnswer(1, - std::string("Can't parse NULL config"))); + return (isc::config::createAnswer(CONTROL_RESULT_ERROR, + std::string("Can't parse NULL config"))); } LOG_DEBUG(dctl_logger, isc::log::DBGLVL_COMMAND, DCTL_CONFIG_START) .arg(redactConfig(config_set)->str()); @@ -122,7 +123,7 @@ DCfgMgrBase::simpleParseConfig(isc::data::ConstElementPtr config_set, } // Use the answer provided. - //answer = isc::config::createAnswer(0, "Configuration committed."); + //answer = isc::config::createAnswer(CONTROL_RESULT_SUCCESS, "Configuration committed."); } else { LOG_INFO(dctl_logger, DCTL_CONFIG_CHECK_COMPLETE) .arg(getConfigSummary(0)) @@ -131,7 +132,7 @@ DCfgMgrBase::simpleParseConfig(isc::data::ConstElementPtr config_set, } catch (const std::exception& ex) { LOG_ERROR(dctl_logger, DCTL_PARSER_FAIL).arg(ex.what()); - answer = isc::config::createAnswer(1, ex.what()); + answer = isc::config::createAnswer(CONTROL_RESULT_ERROR, ex.what()); rollback = true; } diff --git a/src/lib/process/testutils/d_test_stubs.cc b/src/lib/process/testutils/d_test_stubs.cc index 1186729e06..78b73d6ecf 100644 --- a/src/lib/process/testutils/d_test_stubs.cc +++ b/src/lib/process/testutils/d_test_stubs.cc @@ -61,15 +61,16 @@ DStubProcess::shutdown(isc::data::ConstElementPtr /* args */) { setShutdownFlag(true); stopIOService(); - return (isc::config::createAnswer(0, "Shutdown initiated.")); + return (isc::config::createAnswer(isc::config::CONTROL_RESULT_SUCCESS, + "Shutdown initiated.")); } isc::data::ConstElementPtr DStubProcess::configure(isc::data::ConstElementPtr config_set, bool check_only) { if (SimFailure::shouldFailOn(SimFailure::ftProcessConfigure)) { // Simulates a process configure failure. - return (isc::config::createAnswer(1, - "Simulated process configuration error.")); + return (isc::config::createAnswer(isc::config::CONTROL_RESULT_ERROR, + "Simulated process configuration error.")); } return (getCfgMgr()->simpleParseConfig(config_set, check_only)); @@ -329,7 +330,8 @@ DStubCfgMgr::createNewContext() { isc::data::ConstElementPtr DStubCfgMgr::parse(isc::data::ConstElementPtr /*config*/, bool /*check_only*/) { - return (isc::config::createAnswer(0, "It all went fine. I promise")); + return (isc::config::createAnswer(isc::config::CONTROL_RESULT_SUCCESS, + "It all went fine. I promise")); } } // namespace isc::process |