kea-admin lease-upload (2.2.0) invokes kea-lfc without -4 or -6 resulting in misleading error (Unknown argument) if no dhcp version was specified to kea-admin
name: Bug report
about: Create a report to help us improve
Describe the bug
After reading the (concise) documentation of kea-admin
https://kea.readthedocs.io/en/kea-2.2.0/arm/admin.html
and the command line output reported below, I expected to have briefly understood how to use the lease-upload
command,
as for example kea-admin lease-upload pgsql -u kea -n database_name -i lease4file.csv
gave instead error "Unknown argument."
This is a kea-admin script that conducts administrative tasks on
the Kea installation.
Usage: /usr/local/sbin/kea-admin COMMAND BACKEND [parameters]
COMMAND: Currently supported operations are:
- db-init: Initializes new database. Useful for first time installation.
- db-version: Checks version of the existing database schema. Useful
- for checking database version when preparing for an upgrade.
- db-upgrade: Upgrades your database schema.
- lease-dump: Dumps current leases to a memfile-ready CSV file.
- lease-upload: Uploads leases from a CSV file to the database.
- stats-recount: Recounts lease statistics.
BACKEND - one of the supported backends: memfile|mysql|pgsql
PARAMETERS: Parameters are optional in general, but may be required
for specific operations.
-h or --host hostname - specifies a hostname of a database to connect to
-P or --port port - specifies the TCP port to use for the database connection
-u or --user name - specifies username when connecting to a database
-p or --password [password] - specifies a password for the database connection;
if omitted from the command line,
then the user will be prompted for a password
-n or --name database - specifies a database name to connect to
-d or --directory - path to upgrade scripts (default: /usr/local/share/kea/scripts)
-v or --version - print kea-admin version and quit.
-x or --extra - specifies extra argument(s) to pass to the database command
Parameters specific to lease-dump, lease-upload:
-4 to dump IPv4 leases to file
-6 to dump IPv6 leases to file
-i or --input to specify the name of file from which leases will be uploaded
-o or --output to specify the name of file to which leases will be dumped
-y or --yes - assume yes on overwriting temporary files
To Reproduce Steps to reproduce the behavior:
- Prepare Kea daemon dhcpv4 using pgsql as in the following config
"Dhcp4": {
//...
"hosts-database": {
"type": "postgresql",
"name": "database_name",
"user": "kea",
"password": "bugreporting",
"host": "localhost",
"port": 5432
}
start the previously initialized PosgreSQL database service and the kea service. (My environment was OpenBSD 7.3 where I installed PostgreSQL and kea from ports but is probably unrelated)
- Prepare a valid lease4file.csv (as from /var/lib/kea/kea-leases4.csv)
- Run:
kea-admin lease-upload pgsql -u kea -n database_name -i lease4file.csv
- See error, it says "Unknown argument"
- wander what it is (
kea-admin
invokeskea-lfc
with or without the-4
or-6
argument askea-admin
was executed by the user)kea-admin
doesn't document clearly that either-4
or-6
is necessary for thelease-upload
command, and when not specified it doesn't care to invokekea-lfc
which pretend such argument without saying that clearly either).
Expected behavior
At least should say "missing argument" (dhcp version) and the documentation or the code should specify that the kea-admin lease-upload
command needs either -4 or -6, because such information is detected by the file nor by the configuration
Environment:
- kea-dhcp4 -V:
2.2.0
tarball
linked with:
log4cplus 1.2.2
LibreSSL 3.7.2
database:
PostgreSQL backend 13.0, library 150002
Memfile backend 2.1
- OS: OpenBSD 7.3
- Which features were compiled in (in particular which backends): port package kea-2.2.0p0-postgresql
- If/which hooks where loaded in: left as default = no hooks/libraries configured yet
Additional Information
Contacting you How can ISC reach you to discuss this matter further? If you do not specify any means such as e-mail, jabber id or a telephone, we may send you a message on github with questions when we have them. I specified the email address while registering in gitlab.isc.org, this requirement of contact details seems to me obsolete, or I might say you can contact me by email. I'm able to write the code to fix the issue which affects new users, not anymore neither me because I did learn the expected (by the command) way to use the command (by debugging, not messages).