// no new audit revisions are created in any subsequent calls.
ScopedAuditRevision audit_revision(this,
MySqlConfigBackendDHCPv4Impl::CREATE_AUDIT_REVISION,
- server_selector,
- "subnet set", true);
+ server_selector, "subnet set", true);
try {
ScopedAuditRevision
audit_revision(this,
MySqlConfigBackendDHCPv4Impl::CREATE_AUDIT_REVISION,
- server_selector,
- log_message, cascade_delete);
+ server_selector, log_message, cascade_delete);
auto count = deleteFromTable(index, server_selector, operation, keys...);
ScopedAuditRevision
audit_revision(this,
MySqlConfigBackendDHCPv4Impl::CREATE_AUDIT_REVISION,
- server_selector,
- "shared network set", true);
+ server_selector, "shared network set", true);
try {
ScopedAuditRevision
audit_revision(this,
MySqlConfigBackendDHCPv4Impl::CREATE_AUDIT_REVISION,
- server_selector,
- "global option set", false);
+ server_selector, "global option set", false);
if (existing_option) {
in_bindings.push_back(MySqlBinding::createString(tag));
ScopedAuditRevision
audit_revision(this,
MySqlConfigBackendDHCPv4Impl::CREATE_AUDIT_REVISION,
- server_selector,
- "subnet specific option set", cascade_update);
+ server_selector, "subnet specific option set",
+ cascade_update);
if (existing_option) {
in_bindings.push_back(MySqlBinding::createString(tag));
ScopedAuditRevision
audit_revision(this,
MySqlConfigBackendDHCPv4Impl::CREATE_AUDIT_REVISION,
- server_selector,
- "pool specific option set", cascade_update);
+ server_selector, "pool specific option set",
+ cascade_update);
if (existing_option) {
in_bindings.push_back(MySqlBinding::createString(tag));
ScopedAuditRevision
audit_revision(this,
MySqlConfigBackendDHCPv4Impl::CREATE_AUDIT_REVISION,
- server_selector,
- "shared network specific option set",
+ server_selector, "shared network specific option set",
cascade_update);
if (existing_option) {
ScopedAuditRevision
audit_revision(this,
MySqlConfigBackendDHCPv4Impl::CREATE_AUDIT_REVISION,
- server_selector,
- "option definition set",
+ server_selector, "option definition set",
true);
if (existing_definition) {
/// retrieve data from the database.
TaggedStatementArray tagged_statements = { {
{ MySqlConfigBackendDHCPv4Impl::CREATE_AUDIT_REVISION,
- "CALL createAuditRevisionDHCP4(?, ?, ?)"
+ "CALL createAuditRevisionDHCP4(?, ?, ?, ?)"
},
// Select global parameter by name.
const std::string& log_message,
bool cascade_transaction)
: impl_(impl) {
- impl_->createAuditRevision(index, server_selector, log_message,
+ impl_->createAuditRevision(index, server_selector,
+ boost::posix_time::microsec_clock::local_time(),
+ log_message,
cascade_transaction);
}
void
MySqlConfigBackendImpl::createAuditRevision(const int index,
const ServerSelector& server_selector,
+ const boost::posix_time::ptime& audit_ts,
const std::string& log_message,
const bool cascade_transaction) {
// Do not touch existing audit revision in case of the cascade update.
"audit revision");
MySqlBindingCollection in_bindings = {
+ MySqlBinding::createTimestamp(audit_ts),
MySqlBinding::createString(tag),
MySqlBinding::createString(log_message),
MySqlBinding::createInteger<uint8_t>(static_cast<uint8_t>(cascade_transaction))
///
/// @param index query index.
/// @param server_selector Server selector.
+ /// @param audit_ts Timestamp to be associated with the audit
+ /// revision.
/// @param log_message log message to be used for the audit revision.
/// @param cascade_transaction Boolean value indicating whether the
/// configuration modification is performed as part of the ownining
/// audit entry for the owning element should be created.
void createAuditRevision(const int index,
const db::ServerSelector& server_selector,
+ const boost::posix_time::ptime& audit_ts,
const std::string& log_message,
const bool cascade_transaction);
timestamps_["tomorrow"] = timestamps_["today"] + boost::posix_time::hours(24);
}
+ /// @brief Logs audit entries in the @c audit_entries_ member.
+ ///
+ /// This function is called in case of an error.
std::string logExistingAuditEntries() {
std::ostringstream s;
-// Copyright (C) 2014-2018 Internet Systems Consortium, Inc. ("ISC")
+// Copyright (C) 2014-2019 Internet Systems Consortium, Inc. ("ISC")
//
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
OptionDescriptor(const OptionPtr& opt, bool persist,
const std::string& formatted_value = "",
data::ConstElementPtr user_context = data::ConstElementPtr())
- : option_(opt), persistent_(persist),
+ : data::StampedElement(), option_(opt), persistent_(persist),
formatted_value_(formatted_value),
space_name_() {
setContext(user_context);
///
/// @param persist if true option is always sent.
OptionDescriptor(bool persist)
- : option_(OptionPtr()), persistent_(persist),
+ : data::StampedElement(), option_(OptionPtr()), persistent_(persist),
formatted_value_(), space_name_() {};
/// @brief Constructor.
///
/// @param desc descriptor
OptionDescriptor(const OptionDescriptor& desc)
- : option_(desc.option_), persistent_(desc.persistent_),
+ : data::StampedElement(), option_(desc.option_),
+ persistent_(desc.persistent_),
formatted_value_(desc.formatted_value_),
space_name_(desc.space_name_) {
setContext(desc.getContext());
-- data in the database, e.g. when new subnet is added.
--
-- Parameters:
+-- - audit_ts timestamp to be associated with the audit
+-- revision.
-- - server_tag is used to retrieve the server_id which
-- associates the changes applied with the particular
-- server or all servers.
-- -----------------------------------------------------
DROP PROCEDURE IF EXISTS createAuditRevisionDHCP4;
DELIMITER $$
-CREATE PROCEDURE createAuditRevisionDHCP4(IN server_tag VARCHAR(256),
+CREATE PROCEDURE createAuditRevisionDHCP4(IN audit_ts TIMESTAMP(6),
+ IN server_tag VARCHAR(256),
IN audit_log_message TEXT,
IN cascade_transaction TINYINT(1))
BEGIN
DECLARE srv_id BIGINT(20);
SELECT id INTO srv_id FROM dhcp4_server WHERE tag = server_tag;
INSERT INTO dhcp4_audit_revision (modification_ts, server_id, log_message)
- VALUES (NOW(), srv_id, audit_log_message);
+ VALUES (audit_ts, srv_id, audit_log_message);
SET @audit_revision_id = LAST_INSERT_ID();
SET @cascade_transaction = cascade_transaction;
END $$
# data in the database, e.g. when new subnet is added.
--
# Parameters:
+# - audit_ts timestamp to be associated with the audit
+# revision.
# - server_tag is used to retrieve the server_id which
# associates the changes applied with the particular
# server or all servers.
# -----------------------------------------------------
DROP PROCEDURE IF EXISTS createAuditRevisionDHCP4;
DELIMITER $$
-CREATE PROCEDURE createAuditRevisionDHCP4(IN server_tag VARCHAR(256),
+CREATE PROCEDURE createAuditRevisionDHCP4(IN audit_ts TIMESTAMP(6),
+ IN server_tag VARCHAR(256),
IN audit_log_message TEXT,
IN cascade_transaction TINYINT(1))
BEGIN
DECLARE srv_id BIGINT(20);
SELECT id INTO srv_id FROM dhcp4_server WHERE tag = server_tag;
INSERT INTO dhcp4_audit_revision (modification_ts, server_id, log_message)
- VALUES (NOW(), srv_id, audit_log_message);
+ VALUES (audit_ts, srv_id, audit_log_message);
SET @audit_revision_id = LAST_INSERT_ID();
SET @cascade_transaction = cascade_transaction;
END $$