summaryrefslogtreecommitdiffstats
path: root/src/hooks/dhcp/mysql_cb/mysql_cb_impl.cc
diff options
context:
space:
mode:
authorMarcin Siodelski <marcin@isc.org>2019-06-25 18:50:18 +0200
committerMarcin Siodelski <marcin@isc.org>2019-06-27 20:51:31 +0200
commit72bc8cc9645f7280440c0a45d786a26e30c1f797 (patch)
treef10305682eea3bf1716c4ef99451eaa3cdcbeee4 /src/hooks/dhcp/mysql_cb/mysql_cb_impl.cc
parent[642-update-mysql-cb-with-calls-to-set-delete-and-retrieve-servers] Changed n... (diff)
downloadkea-72bc8cc9645f7280440c0a45d786a26e30c1f797.tar.xz
kea-72bc8cc9645f7280440c0a45d786a26e30c1f797.zip
[#642,!373] Addressed review comments.
- Don't allow for deleting logical server 'all'. - Additional tests to make sure that other servers aren't affected by deletion. - Added note that getAll() doesn't return logical server all.
Diffstat (limited to 'src/hooks/dhcp/mysql_cb/mysql_cb_impl.cc')
-rw-r--r--src/hooks/dhcp/mysql_cb/mysql_cb_impl.cc11
1 files changed, 9 insertions, 2 deletions
diff --git a/src/hooks/dhcp/mysql_cb/mysql_cb_impl.cc b/src/hooks/dhcp/mysql_cb/mysql_cb_impl.cc
index b5a9e5d863..30301fc0df 100644
--- a/src/hooks/dhcp/mysql_cb/mysql_cb_impl.cc
+++ b/src/hooks/dhcp/mysql_cb/mysql_cb_impl.cc
@@ -964,7 +964,14 @@ MySqlConfigBackendImpl::createUpdateServer(const int& create_audit_revision,
uint64_t
MySqlConfigBackendImpl::deleteServer(const int& create_audit_revision,
const int& delete_index,
- const std::string& server_tag) {
+ const ServerTag& server_tag) {
+
+ // It is not allowed to delete 'all' logical server.
+ if (server_tag.amAll()) {
+ isc_throw(InvalidOperation, "'all' is a name reserved for the server tag which"
+ " associates the configuration elements with all servers connecting"
+ " to the database and can't be deleted");
+ }
MySqlTransaction transaction(conn_);
@@ -976,7 +983,7 @@ MySqlConfigBackendImpl::deleteServer(const int& create_audit_revision,
// Specify which server should be deleted.
MySqlBindingCollection in_bindings = {
- MySqlBinding::createString(server_tag)
+ MySqlBinding::createString(server_tag.get())
};
// Attempt to delete the server.