2022-10-24 09:10:09 +00:00
|
|
|
# knotctl
|
|
|
|
|
2022-10-25 08:44:19 +02:00
|
|
|
This is a commandline tool for knotapi: https://gitlab.nic.cz/knot/knot-dns-rest
|
2022-10-24 13:28:51 +02:00
|
|
|
|
2022-10-25 08:44:19 +02:00
|
|
|
## Build and install
|
2024-06-27 11:26:12 +02:00
|
|
|
|
|
|
|
To install using pip, run the following command in a virtual envrionment.
|
|
|
|
|
2022-10-25 08:44:19 +02:00
|
|
|
```
|
2024-06-27 11:26:12 +02:00
|
|
|
python -m pip install "knotctl @ git+https://code.smolnet.org/micke/knotctl
|
2022-10-25 08:44:19 +02:00
|
|
|
```
|
2024-06-27 11:26:12 +02:00
|
|
|
|
2022-10-25 08:44:19 +02:00
|
|
|
To build and install as a deb-package
|
2024-06-27 11:26:12 +02:00
|
|
|
|
2022-10-25 08:44:19 +02:00
|
|
|
```
|
2022-10-25 10:59:16 +02:00
|
|
|
sudo apt install python3-stdeb
|
2022-10-25 08:44:19 +02:00
|
|
|
git clone https://code.smolnet.org/micke/knotctl
|
|
|
|
cd knotctl
|
|
|
|
python3 setup.py --command-packages=stdeb.command bdist_deb
|
2022-11-10 12:53:44 +00:00
|
|
|
sudo dpkg -i deb_dist/knotctl_*_all.deb
|
2022-10-25 08:44:19 +02:00
|
|
|
```
|
2022-10-25 09:10:39 +00:00
|
|
|
A prebuilt deb-package is also available from the release page: https://code.smolnet.org/micke/knotctl/releases/
|
|
|
|
|
2022-10-25 08:44:19 +02:00
|
|
|
## Shell completion
|
2024-06-27 11:26:12 +02:00
|
|
|
|
2022-10-25 08:44:19 +02:00
|
|
|
For bash: add this to .bashrc
|
2024-06-27 11:26:12 +02:00
|
|
|
|
2022-10-25 08:44:19 +02:00
|
|
|
```
|
2022-10-27 15:20:20 +02:00
|
|
|
source <(knotctl completion)
|
2022-10-25 08:44:19 +02:00
|
|
|
```
|
2024-06-27 11:26:12 +02:00
|
|
|
|
2022-10-25 08:44:19 +02:00
|
|
|
For fish, run:
|
2024-06-27 11:26:12 +02:00
|
|
|
|
2022-10-25 08:44:19 +02:00
|
|
|
```
|
2022-10-27 15:20:20 +02:00
|
|
|
knotctl completion --shell fish > ~/.config/fish/completions/knotctl.fish
|
2022-10-25 08:44:19 +02:00
|
|
|
```
|
2024-06-27 11:26:12 +02:00
|
|
|
|
2022-10-25 08:44:19 +02:00
|
|
|
For tcsh: add this to .cshrc
|
2024-06-27 11:26:12 +02:00
|
|
|
|
2022-10-25 08:44:19 +02:00
|
|
|
```
|
|
|
|
complete "knotctl" 'p@*@`python-argcomplete-tcsh "knotctl"`@' ;
|
|
|
|
```
|
2024-06-27 11:26:12 +02:00
|
|
|
|
2022-10-25 08:44:19 +02:00
|
|
|
For zsh: add this to .zshrc
|
2024-06-27 11:26:12 +02:00
|
|
|
|
2022-10-25 08:44:19 +02:00
|
|
|
```
|
|
|
|
autoload -U bashcompinit
|
|
|
|
bashcompinit
|
2022-10-27 15:20:20 +02:00
|
|
|
source <(knotctl completion)
|
2022-10-25 08:44:19 +02:00
|
|
|
```
|
2022-10-24 13:28:51 +02:00
|
|
|
## Usage
|
2024-06-27 11:26:12 +02:00
|
|
|
|
2022-10-24 13:28:51 +02:00
|
|
|
```
|
2022-10-24 19:13:24 +02:00
|
|
|
usage: knotctl [-h] [--json | --no-json]
|
2022-10-27 15:20:20 +02:00
|
|
|
{add,completion,config,delete,list,update} ...
|
2022-10-24 17:55:33 +02:00
|
|
|
|
|
|
|
positional arguments:
|
2022-10-27 15:20:20 +02:00
|
|
|
{add,completion,config,delete,list,update}
|
2022-10-24 17:55:33 +02:00
|
|
|
|
|
|
|
options:
|
|
|
|
-h, --help show this help message and exit
|
|
|
|
--json, --no-json
|
2022-10-24 13:28:51 +02:00
|
|
|
```
|
2024-06-27 11:26:12 +02:00
|
|
|
|
2022-10-24 17:55:33 +02:00
|
|
|
### ADD
|
2024-06-27 11:26:12 +02:00
|
|
|
|
2022-10-24 13:28:51 +02:00
|
|
|
```
|
2022-11-10 12:50:18 +01:00
|
|
|
usage: knotctl add [-h] -d DATA -n NAME -r RTYPE [-t TTL] -z ZONE
|
2022-10-24 17:55:33 +02:00
|
|
|
|
|
|
|
options:
|
|
|
|
-h, --help show this help message and exit
|
|
|
|
-d DATA, --data DATA
|
|
|
|
-n NAME, --name NAME
|
|
|
|
-r RTYPE, --rtype RTYPE
|
|
|
|
-t TTL, --ttl TTL
|
|
|
|
-z ZONE, --zone ZONE
|
2022-10-24 13:28:51 +02:00
|
|
|
```
|
2024-06-27 11:26:12 +02:00
|
|
|
|
2022-10-27 15:20:20 +02:00
|
|
|
### COMPLETION
|
2024-06-27 11:26:12 +02:00
|
|
|
|
2022-10-24 19:13:24 +02:00
|
|
|
```
|
2022-10-27 15:20:20 +02:00
|
|
|
usage: knotctl completion [-h] [-s SHELL]
|
2022-10-24 19:13:24 +02:00
|
|
|
|
|
|
|
options:
|
|
|
|
-h, --help show this help message and exit
|
|
|
|
-s SHELL, --shell SHELL
|
|
|
|
```
|
2024-06-27 11:26:12 +02:00
|
|
|
|
2022-10-24 17:55:33 +02:00
|
|
|
### CONFIG
|
2024-06-27 11:26:12 +02:00
|
|
|
|
2022-10-24 13:28:51 +02:00
|
|
|
```
|
2024-06-24 16:03:36 +02:00
|
|
|
usage: knotctl config [-h] [-c CONTEXT] [-b BASEURL] [-p PASSWORD] [-u USERNAME]
|
2022-10-24 17:55:33 +02:00
|
|
|
|
|
|
|
options:
|
|
|
|
-h, --help show this help message and exit
|
2024-06-24 16:03:36 +02:00
|
|
|
-c CONTEXT, --context CONTEXT
|
2022-10-24 17:55:33 +02:00
|
|
|
-b BASEURL, --baseurl BASEURL
|
|
|
|
-p PASSWORD, --password PASSWORD
|
|
|
|
-u USERNAME, --username USERNAME
|
2022-10-24 13:28:51 +02:00
|
|
|
```
|
2024-06-27 11:26:12 +02:00
|
|
|
|
2022-10-24 17:55:33 +02:00
|
|
|
### DELETE
|
2024-06-27 11:26:12 +02:00
|
|
|
|
2022-10-24 13:28:51 +02:00
|
|
|
```
|
2022-10-24 17:55:33 +02:00
|
|
|
usage: knotctl delete [-h] [-d DATA] [-n NAME] [-r RTYPE] -z ZONE
|
|
|
|
|
|
|
|
options:
|
|
|
|
-h, --help show this help message and exit
|
|
|
|
-d DATA, --data DATA
|
|
|
|
-n NAME, --name NAME
|
|
|
|
-r RTYPE, --rtype RTYPE
|
|
|
|
-z ZONE, --zone ZONE
|
2022-10-24 13:28:51 +02:00
|
|
|
```
|
2024-06-27 11:26:12 +02:00
|
|
|
|
2022-10-24 17:55:33 +02:00
|
|
|
### LIST
|
2024-06-27 11:26:12 +02:00
|
|
|
|
2022-10-24 13:28:51 +02:00
|
|
|
```
|
2022-10-24 17:55:33 +02:00
|
|
|
usage: knotctl list [-h] [-d DATA] [-n NAME] [-r RTYPE] [-z ZONE]
|
|
|
|
|
|
|
|
options:
|
|
|
|
-h, --help show this help message and exit
|
|
|
|
-d DATA, --data DATA
|
|
|
|
-n NAME, --name NAME
|
|
|
|
-r RTYPE, --rtype RTYPE
|
|
|
|
-z ZONE, --zone ZONE
|
2022-10-24 13:28:51 +02:00
|
|
|
```
|
2024-06-27 11:26:12 +02:00
|
|
|
|
2022-10-24 17:55:33 +02:00
|
|
|
### UPDATE
|
2024-06-27 11:26:12 +02:00
|
|
|
|
2022-10-24 13:28:51 +02:00
|
|
|
```
|
2022-10-27 15:51:08 +02:00
|
|
|
usage: knotctl update [-h] -a [ARGUMENT ...] -d DATA -n NAME -r RTYPE [-t TTL]
|
|
|
|
-z ZONE
|
2022-10-24 17:55:33 +02:00
|
|
|
|
|
|
|
options:
|
|
|
|
-h, --help show this help message and exit
|
2022-10-27 15:51:08 +02:00
|
|
|
-a [ARGUMENT ...], --argument [ARGUMENT ...]
|
|
|
|
Specify key - value pairs to be updated:
|
|
|
|
name=dns1.example.com.
|
2022-10-24 17:55:33 +02:00
|
|
|
-d DATA, --data DATA
|
|
|
|
-n NAME, --name NAME
|
|
|
|
-r RTYPE, --rtype RTYPE
|
|
|
|
-t TTL, --ttl TTL
|
|
|
|
-z ZONE, --zone ZONE
|
2022-10-24 13:28:51 +02:00
|
|
|
```
|