Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
ISC Open Source Projects
Kea
Commits
4038157a
Commit
4038157a
authored
Apr 04, 2017
by
Tomek Mrugalski
🛰
Browse files
[master] Merge branch 'github14' (-h parameter to kea-admin)
# Conflicts: # ChangeLog
parents
eb853fe2
1c406d1a
Changes
5
Hide whitespace changes
Inline
Side-by-side
AUTHORS
View file @
4038157a
...
...
@@ -133,12 +133,15 @@ We have received the following contributions:
- Sebasian Schrader
2017-01: Fix build dir in doc/guide/Makefile.am
- Marvin Frick (MrMarvin)
2017-04: -h and --host parameters added to kea-admin
Kea uses log4cplus (http://sourceforge.net/projects/log4cplus/) for logging,
Boost (http://www.boost.org/) library for almost everything, and can use Botan
(http://botan.randombit.net/) or OpenSSL (https://www.openssl.org/) for
cryptographic operations. It can also optionally use PostgreSQL
(http://www.postgresql.org/) and/or MySQL (http://www.mysql.com/) as a database.
Kea can use googletest for unit-tests (http://
code.google.com/p
/googletest
/
).
Kea can use googletest for unit-tests (http
s
://
github.com/google
/googletest).
Kea uses ISC Forge (http://
kea.isc.org/wiki/IscF
orge) for conformance testing.
Kea uses ISC Forge (http
s
://
github.com/isc-projects/f
orge
/
) for conformance testing.
ChangeLog
View file @
4038157a
1235. [func] MrMarvin
kea-admin now supports -h (and --host) parameter that can specify
MySQL or PostgreSQL database locations other than the default
localhost.
(Github #14, git tbd)
1234. [build] fdupont
Improved installation procedure for kea-shell.
(Trac #5170, git 68a902fb723965ee6f5b7a8272224395917525cc)
...
...
src/bin/admin/admin-utils.sh
View file @
4038157a
...
...
@@ -22,7 +22,7 @@ mysql_execute() {
mysql
-N
-B
$*
-e
"
${
QUERY
}
"
retcode
=
$?
else
mysql
-N
-B
--user
=
$db_user
--password
=
$db_password
-e
"
${
QUERY
}
"
$db_name
mysql
-N
-B
--host
=
$db_host
--user
=
$db_user
--password
=
$db_password
-e
"
${
QUERY
}
"
$db_name
retcode
=
"
$?
"
fi
...
...
@@ -52,7 +52,7 @@ pgsql_execute() {
retcode
=
$?
else
export
PGPASSWORD
=
$db_password
echo
$QUERY
| psql
--set
ON_ERROR_STOP
=
1
-A
-t
-h
local
host
-q
-U
$db_user
-d
$db_name
echo
$QUERY
| psql
--set
ON_ERROR_STOP
=
1
-A
-t
-h
$db_
host
-q
-U
$db_user
-d
$db_name
retcode
=
$?
fi
return
$retcode
...
...
@@ -76,7 +76,7 @@ pgsql_execute_script() {
retcode
=
$?
else
export
PGPASSWORD
=
$db_password
psql
--set
ON_ERROR_STOP
=
1
-A
-t
-h
local
host
-q
-U
$db_user
-d
$db_name
-f
$file
psql
--set
ON_ERROR_STOP
=
1
-A
-t
-h
$db_
host
-q
-U
$db_user
-d
$db_name
-f
$file
retcode
=
$?
fi
return
$retcode
...
...
src/bin/admin/kea-admin.in
View file @
4038157a
...
...
@@ -21,6 +21,7 @@ scripts_dir=${SCRIPTS_DIR_DEFAULT}
# These are the default parameters. They will likely not work in any
# specific deployment.
db_host
=
"localhost"
db_user
=
"keatest"
db_password
=
"keatest"
db_name
=
"keatest"
...
...
@@ -59,6 +60,7 @@ usage() {
printf
"
\n
"
printf
"PARAMETERS: Parameters are optional in general, but may be required
\n
"
printf
" for specific operation.
\n
"
printf
" -h or --host hostname - specifies a hostname of a database to connect to
\n
"
printf
" -u or --user name - specifies username when connecting to a database
\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
"
...
...
@@ -153,7 +155,7 @@ mysql_init() {
fi
printf
"Initializing database using script %s
\n
"
$scripts_dir
/mysql/dhcpdb_create.mysql
mysql
-B
--user
=
$db_user
--password
=
$db_password
$db_name
<
$scripts_dir
/mysql/dhcpdb_create.mysql
mysql
-B
--host
=
$db_host
--user
=
$db_user
--password
=
$db_password
$db_name
<
$scripts_dir
/mysql/dhcpdb_create.mysql
ERRCODE
=
$?
printf
"mysql returned status code
$ERRCODE
\n
"
...
...
@@ -260,7 +262,7 @@ mysql_upgrade() {
for
script
in
${
scripts_dir
}
/mysql/upgrade
*
.sh
do
echo
"Processing
$script
file..."
sh
${
script
}
--user
=
${
db_user
}
--password
=
${
db_password
}
${
db_name
}
sh
${
script
}
--host
=
${
db_host
}
--user
=
${
db_user
}
--password
=
${
db_password
}
${
db_name
}
done
printf
"Lease DB version reported after upgrade: "
...
...
@@ -292,7 +294,7 @@ pgsql_upgrade() {
for
script
in
${
scripts_dir
}
/pgsql/upgrade
*
.sh
do
echo
"Processing
$script
file..."
sh
${
script
}
-U
${
db_user
}
-h
local
host
-d
${
db_name
}
sh
${
script
}
-U
${
db_user
}
-h
${
db_
host
}
-d
${
db_name
}
done
version
=
`
pgsql_version
`
...
...
@@ -457,7 +459,7 @@ pgsql_dump() {
# Call psql and redirect output to the dump file. We don't use psql "to csv"
# as it can only be run as db superuser.
echo
"
$dump_qry
"
| psql
--set
ON_ERROR_STOP
=
1
-t
-h
local
host
-q
--user
=
$db_user
--dbname
=
$db_name
-w
--no-align
--field-separator
=
','
>
$dump_file
echo
"
$dump_qry
"
| psql
--set
ON_ERROR_STOP
=
1
-t
-h
$db_
host
-q
--user
=
$db_user
--dbname
=
$db_name
-w
--no-align
--field-separator
=
','
>
$dump_file
retcode
=
$?
# Check for errors.
...
...
@@ -547,6 +549,16 @@ while [ ! -z "${1}" ]
do
option
=
${
1
}
case
${
option
}
in
# Specify database host
-h
|
--host
)
shift
db_host
=
${
1
}
if
[
-z
${
db_host
}
]
;
then
log_error
"-h or --host requires a parameter"
usage
exit
1
fi
;;
# Specify database user
-u
|
--user
)
shift
...
...
src/bin/admin/tests/pgsql_tests.sh.in
View file @
4038157a
#!/bin/sh
# Copyright (C) 2015-201
6
Internet Systems Consortium, Inc. ("ISC")
# Copyright (C) 2015-201
7
Internet Systems Consortium, Inc. ("ISC")
#
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
...
...
@@ -18,6 +18,7 @@ db_scripts_dir=@abs_top_srcdir@/src/share/database/scripts
db_user
=
"keatest"
db_password
=
"keatest"
db_name
=
"keatest"
db_host
=
"localhost"
# Set location of the kea-admin.
keaadmin
=
@abs_top_builddir@/src/bin/admin/kea-admin
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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