prefix=@prefix@
SCRIPTS_DIR_DEFAULT=@datarootdir@/@PACKAGE@/scripts
scripts_dir=${SCRIPTS_DIR_DEFAULT}
+VERSION=@PACKAGE_VERSION@
# These are the default parameters. They will likely not work in any
# specific deployment.
# Prints out usage version.
usage() {
- printf "kea-admin @PACKAGE_VERSION@\n"
+ printf "kea-admin $VERSION\n"
printf "\n"
printf "This is a kea-admin script that conducts administrative tasks on\n"
printf "the Kea installation.\n"
printf " -p or --password pass - specifies a password when connecting to a database\n"
printf " -n or --name database - specifies a database name to connect to\n"
printf " -d or --directory - path to upgrade scripts (default: ${SCRIPTS_DIR_DEFAULT})\n"
+ printf " -v - print kea-admin version and quit.\n"
printf "\n"
printf " Parameters specific to lease-dump:\n"
printf " -4 to dump IPv4 leases to file\n"
usage
exit 1
fi
+
+# Check if this is a simple question about version.
+if test "${command}" = "-v" || test "${command}" = "--version" ; then
+ echo "${VERSION}"
+ exit 0
+fi
+
is_in_list "${command}" "lease-init lease-version lease-upgrade lease-dump"
if [ ${_inlist} -eq 0 ]; then
log_error "invalid command: ${command}"
# Include common test library.
. @abs_top_builddir@/src/lib/testutils/dhcp_test_lib.sh
+# Set location of the kea-admin.
+keaadmin=@abs_top_builddir@/src/bin/admin/kea-admin
+
memfile_init_test() {
test_start "memfile.init"
-
+
# @todo: Implement this (ticket #3601)
test_finish 0
memfile_version_test() {
test_start "memfile.version"
-
+
# @todo: Implement this (ticket #3601)
test_finish 0
memfile_upgrade_test() {
test_start "memfile.upgrade"
-
+
# @todo: Implement this (ticket #3601)
test_finish 0
}
+# This test checks version reported by kea-admin. It has nothing to do
+# with memfile, but that is the only test file that is always ran,
+# so decided to put the generic test here.
+version_test() {
+ test_start "version"
+
+ # This is what we expect to get.
+ EXPECTED_VERSION=@PACKAGE_VERSION@
+
+ # Let's use short version: -v
+ reported_version=$(${keaadmin} -v)
+
+ assert_str_eq ${EXPECTED_VERSION} ${reported_version} \
+ "Expected kea-admin -v to report %s, but it reported %s"
+
+ # Let's try the long version: --version
+ reported_version=$(${keaadmin} --version)
+
+ assert_str_eq ${EXPECTED_VERSION} ${reported_version} \
+ "Expected kea-admin -v to report %s, but it reported %s"
+
+ # This is a test whether the reviewer pays any attention. If you miss this
+ # nonsense, you owe me a beer. If you spot it, it's the other way around.
+ test_finish 0
+}
+
+
+version_test
+
memfile_init_test
memfile_version_test
memfile_upgrade_test