Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Knot DNS
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
22
Issues
22
List
Boards
Labels
Service Desk
Milestones
Merge Requests
17
Merge Requests
17
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Packages & Registries
Packages & Registries
Container Registry
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Knot projects
Knot DNS
Commits
4560fc55
Commit
4560fc55
authored
Nov 09, 2015
by
Daniel Salzman
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ctl: remove conf-write and conf-delete operations
parent
291e95be
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
3 additions
and
106 deletions
+3
-106
doc/man/knotc.8in
doc/man/knotc.8in
+0
-8
doc/man_knotc.rst
doc/man_knotc.rst
+0
-8
doc/operation.rst
doc/operation.rst
+3
-9
src/knot/ctl/knotc_main.c
src/knot/ctl/knotc_main.c
+0
-31
src/knot/ctl/remote.c
src/knot/ctl/remote.c
+0
-50
No files found.
doc/man/knotc.8in
View file @
4560fc55
...
...
@@ -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.
...
...
doc/man_knotc.rst
View file @
4560fc55
...
...
@@ -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.
...
...
doc/operation.rst
View file @
4560fc55
...
...
@@ -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
...
...
src/knot/ctl/knotc_main.c
View file @
4560fc55
...
...
@@ -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
)
{
...
...
src/knot/ctl/remote.c
View file @
4560fc55
...
...
@@ -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.
*/
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment