Browse Source

[3599] kea-admin.in is now documented.

Tomek Mrugalski 10 years ago
parent
commit
a0cb843d53
1 changed files with 20 additions and 1 deletions
  1. 20 1
      src/bin/admin/kea-admin.in

+ 20 - 1
src/bin/admin/kea-admin.in

@@ -40,7 +40,7 @@ else
     . @abs_top_builddir@/src/bin/admin/admin-utils.sh
     . @abs_top_builddir@/src/bin/admin/admin-utils.sh
 fi
 fi
 
 
-
+# Prints out usage version.
 usage() {
 usage() {
     printf "kea-admin @PACKAGE_VERSION@\n"
     printf "kea-admin @PACKAGE_VERSION@\n"
     printf "\n"
     printf "\n"
@@ -70,16 +70,19 @@ usage() {
 ### Logging functions ###
 ### Logging functions ###
 
 
 # Logs message at the error level.
 # Logs message at the error level.
+# Takes one parameter that is printed as is.
 log_error() {
 log_error() {
     printf "ERROR/kea-admin: ${1}\n"
     printf "ERROR/kea-admin: ${1}\n"
 }
 }
 
 
 # Logs message at the warning level.
 # Logs message at the warning level.
+# Takes one parameter that is printed as is.
 log_warning() {
 log_warning() {
     printf "WARNING/kea-admin: ${1}\n"
     printf "WARNING/kea-admin: ${1}\n"
 }
 }
 
 
 # Logs message at the info level.
 # Logs message at the info level.
+# Takes one parameter that is printed as is.
 log_info() {
 log_info() {
     printf "INFO/kea-admin: ${1}\n"
     printf "INFO/kea-admin: ${1}\n"
 }
 }
@@ -109,11 +112,17 @@ is_in_list() {
 
 
 
 
 ### Functions that implement database initialization commands
 ### Functions that implement database initialization commands
+
 memfile_init() {
 memfile_init() {
+    # @todo Implement this as part of #3601
     log_error "NOT IMPLEMENTED"
     log_error "NOT IMPLEMENTED"
     exit 1
     exit 1
 }
 }
 
 
+# Initializes a new, empty MySQL database.
+# It essentially calls scripts/mysql/dhcpdb_create.mysql script, with
+# some extra sanity checks. It will refuse to use it if there are any
+# existing tables. It's better safe than sorry.
 mysql_init() {
 mysql_init() {
     printf "Checking if there is a database initialized already. Please ignore errors.\n"
     printf "Checking if there is a database initialized already. Please ignore errors.\n"
 
 
@@ -154,6 +163,7 @@ pgsql_init() {
 
 
 ### Functions that implement database version checking commands
 ### Functions that implement database version checking commands
 memfile_version() {
 memfile_version() {
+    # @todo Implement this as part of #3601
     log_error "NOT IMPLEMENTED"
     log_error "NOT IMPLEMENTED"
     exit 1
     exit 1
 }
 }
@@ -165,10 +175,17 @@ pgsql_version() {
 
 
 ### Functions used for upgrade
 ### Functions used for upgrade
 memfile_upgrade() {
 memfile_upgrade() {
+    # @todo Implement this as part of #3601
     log_error "NOT IMPLEMENTED"
     log_error "NOT IMPLEMENTED"
     exit 1
     exit 1
 }
 }
 
 
+# Upgrades existing MySQL database installation. The idea is that
+# it will go over all upgrade scripts from (prefix)/share/kea/scripts/mysql
+# and run them one by one. They will be named properly, so they will
+# be run in order.
+#
+# This function prints version before and after upgrade.
 mysql_upgrade() {
 mysql_upgrade() {
 
 
     printf "Version reported before upgrade: "
     printf "Version reported before upgrade: "
@@ -206,6 +223,7 @@ pgsql_upgrade() {
 
 
 ### Script starts here ###
 ### Script starts here ###
 
 
+# First, find what the command is
 command=${1}
 command=${1}
 if [ -z ${command} ]; then
 if [ -z ${command} ]; then
     log_error "missing command"
     log_error "missing command"
@@ -219,6 +237,7 @@ if [ ${_inlist} -eq 0 ]; then
 fi
 fi
 shift
 shift
 
 
+# Second, check what's the backend
 backend=${1}
 backend=${1}
 if [ -z ${backend} ]; then
 if [ -z ${backend} ]; then
     log_error "missing backend"
     log_error "missing backend"