17#include <boost/lexical_cast.hpp>
18#include <boost/algorithm/string.hpp>
69 static list<list<string>>
const list;
76 const std::function<
void()>& post_config_cb) {
79 std::string(
"Can't parse NULL config")));
92 bool rollback =
false;
102 answer =
parse(config_set, check_only);
112 if (post_config_cb) {
117 auto now = boost::posix_time::second_clock::universal_time();
118 context_->setLastCommitTime(now);
131 }
catch (
const std::exception& ex) {
140 context_ = original_context;
145 context_ = original_context;
Exception thrown if the configuration manager encounters an error.
virtual void setCfgDefaults(isc::data::ElementPtr mutable_config)
Adds default values to the given config.
virtual std::list< std::list< std::string > > jsonPathsToRedact() const
Return a list of all paths that contain passwords or secrets.
DCfgMgrBase(ConfigPtr context)
Constructor.
virtual isc::data::ConstElementPtr parse(isc::data::ConstElementPtr config, bool check_only)
Parses actual configuration.
virtual ~DCfgMgrBase()
Destructor.
isc::data::ConstElementPtr simpleParseConfig(isc::data::ConstElementPtr config, bool check_only=false, const std::function< void()> &post_config_cb=nullptr)
Acts as the receiver of new configurations.
void resetContext()
Replaces existing context with a new, empty context.
void setContext(ConfigPtr &context)
Update the current context.
virtual ConfigPtr createNewContext()=0
Abstract factory which creates a context instance.
virtual std::string getConfigSummary(const uint32_t selection)=0
Returns configuration summary in the textual format.
isc::data::ConstElementPtr redactConfig(isc::data::ConstElementPtr const &config) const
Redact the configuration.
static void configureLogger(const isc::data::ConstElementPtr &log_config, const isc::process::ConfigPtr &storage)
Configures logger.
This file contains several functions and constants that are used for handling commands and responses ...
#define isc_throw(type, stream)
A shortcut macro to insert known values into exception arguments.
#define LOG_ERROR(LOGGER, MESSAGE)
Macro to conveniently test error output and log it.
#define LOG_INFO(LOGGER, MESSAGE)
Macro to conveniently test info output and log it.
#define LOG_DEBUG(LOGGER, LEVEL, MESSAGE)
Macro to conveniently test debug output and log it.
std::string answerToText(const ConstElementPtr &msg)
Converts answer to printable text.
ConstElementPtr parseAnswer(int &rcode, const ConstElementPtr &msg)
Parses a standard config/command level answer and returns arguments or text status code.
const int CONTROL_RESULT_ERROR
Status code indicating a general failure.
ConstElementPtr createAnswer()
Creates a standard config/command level success answer message (i.e.
boost::shared_ptr< const Element > ConstElementPtr
boost::shared_ptr< Element > ElementPtr
const int DBGLVL_COMMAND
This debug level is reserved for logging the exchange of messages/commands between processes,...
isc::log::Logger dctl_logger("dctl")
Defines the logger used within libkea-process library.
const isc::log::MessageID DCTL_CONFIG_START
const isc::log::MessageID DCTL_CONFIG_CHECK_COMPLETE
boost::shared_ptr< ConfigBase > ConfigPtr
Non-const pointer to the ConfigBase.
const isc::log::MessageID DCTL_PARSER_FAIL
const isc::log::MessageID DCTL_CONFIG_COMPLETE
ConstElementPtr redactConfig(ConstElementPtr const &element, list< string > const &json_path)
Redact a configuration.
Defines the logger used by the top-level component of kea-lfc.