18#include <boost/foreach.hpp>
19#include <boost/lexical_cast.hpp>
20#include <boost/algorithm/string.hpp>
70 static list<list<string>>
const list;
77 const std::function<
void()>& post_config_cb) {
80 std::string(
"Can't parse NULL config")));
93 bool rollback =
false;
103 answer =
parse(config_set, check_only);
113 if (post_config_cb) {
118 auto now = boost::posix_time::second_clock::universal_time();
119 context_->setLastCommitTime(now);
132 }
catch (
const std::exception& ex) {
141 context_ = original_context;
146 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.
ConstElementPtr createAnswer(const int status_code, const std::string &text, const ConstElementPtr &arg)
ConstElementPtr parseAnswer(int &rcode, const ConstElementPtr &msg)
std::string answerToText(const ConstElementPtr &msg)
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.