Commit 4560fc55 authored by Daniel Salzman's avatar Daniel Salzman

ctl: remove conf-write and conf-delete operations

parent 291e95be
......@@ -125,14 +125,6 @@ the list of sections is returned.
\fBconf\-read\fP [\fIitem\fP]
Read from the current configuration DB.
.TP
\fBconf\-write\fP \fIitem\fP [\fIdata\fP\&...]
Write to the current configuration DB. A writing transaction is started
and finished automatically.
.TP
\fBconf\-delete\fP [\fIitem\fP] [\fIdata\fP\&...]
Delete from the current configuration DB. A writing transaction is started
and finished automatically.
.TP
\fBconf\-begin\fP
Begin a writing configuration DB transaction. Only one transaction can be
opened at a time.
......
......@@ -102,14 +102,6 @@ format.
**conf-read** [*item*]
Read from the current configuration DB.
**conf-write** *item* [*data*...]
Write to the current configuration DB. A writing transaction is started
and finished automatically.
**conf-delete** [*item*] [*data*...]
Delete from the current configuration DB. A writing transaction is started
and finished automatically.
**conf-begin**
Begin a writing configuration DB transaction. Only one transaction can be
opened at a time.
......
......@@ -59,7 +59,7 @@ The configuration database can be accessed using the server remote control
during the running server. To get the full power of the dynamic configuration,
the server must be started with a specified configuration database location::
$ knotd -C /var/lib/knot/confdb
$ knotd -C db_path
*Note:* The database can be :ref:`imported<Configuration database>` in advance.
......@@ -126,25 +126,19 @@ identified section or for a specific item::
$ knotc conf-diff zone[example.com]
$ knotc conf-diff zone[example.com].master
For simple and infrequent modifications, there are "lazy" variants of
``conf-set`` and ``conf-unset`` operations (``conf-write`` and ``conf-delete``
respectively) which activate and commit/abort the change automatically.
An example of possible configuration initialization::
$ knotc conf-write server.listen 0.0.0.0@53 ::@53
$ knotc conf-begin
$ knotc conf-set server.listen 0.0.0.0@53 ::@53
$ knotc conf-set remote[master_server]
$ knotc conf-set remote[master_server].address 192.168.1.1
$ knotc conf-set template[default]
$ knotc conf-set template[default].storage /var/lib/knot/zones/
$ knotc conf-set template[default].master master_server
$ knotc conf-set zone[example.com]
$ knotc conf-diff
$ knotc conf-commit
$ knotc conf-write zone[example.com]
.. _Running a slave server:
Slave mode
......
......@@ -87,8 +87,6 @@ static int cmd_conf_import(cmd_args_t *args);
static int cmd_conf_export(cmd_args_t *args);
static int cmd_conf_desc(cmd_args_t *args);
static int cmd_conf_read(cmd_args_t *args);
static int cmd_conf_write(cmd_args_t *args);
static int cmd_conf_delete(cmd_args_t *args);
static int cmd_conf_begin(cmd_args_t *args);
static int cmd_conf_commit(cmd_args_t *args);
static int cmd_conf_abort(cmd_args_t *args);
......@@ -115,8 +113,6 @@ knot_cmd_t knot_cmd_tbl[] = {
{ &cmd_conf_export, "conf-export", "<filename>", "Export config DB to file." },
{ &cmd_conf_desc, "conf-desc", "[<item>]", "Get config DB item list." },
{ &cmd_conf_read, "conf-read", "[<item>]", "Read item(s) from active config DB." },
{ &cmd_conf_write, "conf-write", "<item> [<data>...]", "Write item(s) into active config DB." },
{ &cmd_conf_delete, "conf-delete", "[<item>] [<data>...]", "Delete item(s) from active config DB." },
{ &cmd_conf_begin, "conf-begin", "", "Begin config DB transaction." },
{ &cmd_conf_commit, "conf-commit", "", "Commit config DB transaction." },
{ &cmd_conf_abort, "conf-abort", "", "Rollback config DB transaction." },
......@@ -662,33 +658,6 @@ static int cmd_conf_read(cmd_args_t *args)
args->argc, args->argv);
}
static int cmd_conf_write(cmd_args_t *args)
{
if (args->argc < 1 || args->argc > 255) {
printf("command takes one or up to 255 arguments\n");
return KNOT_EINVAL;
}
return cmd_remote(args->addr, args->key, "conf-write", KNOT_RRTYPE_TXT,
args->argc, args->argv);
}
static int cmd_conf_delete(cmd_args_t *args)
{
if (args->argc > 255) {
printf("command doesn't take more than 255 arguments\n");
return KNOT_EINVAL;
}
if (args->argc < 1 && !has_flag(args->flags, F_FORCE)) {
printf("use force option to delete the whole configuration!\n");
return KNOT_EDENIED;
}
return cmd_remote(args->addr, args->key, "conf-delete", KNOT_RRTYPE_TXT,
args->argc, args->argv);
}
static int cmd_conf_begin(cmd_args_t *args)
{
if (args->argc > 0) {
......
......@@ -129,8 +129,6 @@ static int remote_c_conf_abort(server_t *s, remote_cmdargs_t *a);
static int remote_c_conf_desc(server_t *s, remote_cmdargs_t *a);
static int remote_c_conf_diff(server_t *s, remote_cmdargs_t *a);
static int remote_c_conf_read(server_t *s, remote_cmdargs_t *a);
static int remote_c_conf_write(server_t *s, remote_cmdargs_t *a);
static int remote_c_conf_delete(server_t *s, remote_cmdargs_t *a);
static int remote_c_conf_get(server_t *s, remote_cmdargs_t *a);
static int remote_c_conf_set(server_t *s, remote_cmdargs_t *a);
static int remote_c_conf_unset(server_t *s, remote_cmdargs_t *a);
......@@ -151,8 +149,6 @@ struct remote_cmd remote_cmd_tbl[] = {
{ "conf-desc", &remote_c_conf_desc },
{ "conf-diff", &remote_c_conf_diff },
{ "conf-read", &remote_c_conf_read },
{ "conf-write", &remote_c_conf_write },
{ "conf-delete", &remote_c_conf_delete },
{ "conf-get", &remote_c_conf_get },
{ "conf-set", &remote_c_conf_set },
{ "conf-unset", &remote_c_conf_unset },
......@@ -797,52 +793,6 @@ static int remote_c_conf_read(server_t *s, remote_cmdargs_t *a)
return conf_read(s, a, true);
}
/*!
* \brief Remote command 'conf-write' handler.
*/
static int remote_c_conf_write(server_t *s, remote_cmdargs_t *a)
{
UNUSED(s);
dbg_server("remote: %s\n", __func__);
int ret = remote_c_conf_begin(s, a);
if (ret != KNOT_EOK) {
return ret;
}
// Set item(s) value.
ret = remote_c_conf_set(s, a);
if (ret != KNOT_EOK) {
remote_c_conf_abort(s, a);
return ret;
}
return remote_c_conf_commit(s, a);
}
/*!
* \brief Remote command 'conf-delete' handler.
*/
static int remote_c_conf_delete(server_t *s, remote_cmdargs_t *a)
{
UNUSED(s);
dbg_server("remote: %s\n", __func__);
int ret = remote_c_conf_begin(s, a);
if (ret != KNOT_EOK) {
return ret;
}
// Delete item(s) value.
ret = remote_c_conf_unset(s, a);
if (ret != KNOT_EOK) {
remote_c_conf_abort(s, a);
return ret;
}
return remote_c_conf_commit(s, a);
}
/*!
* \brief Remote command 'conf-get' handler.
*/
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment