Skip to content

Commit

Permalink
bareos-config get_database_param: use dbcheck
Browse files Browse the repository at this point in the history
modified get_database_param to use bareos-dbcheck to get database parameter
instead of directly accessing the Bareos Director config file.
Because bareos-dbcheck uses the Bareos config parser this prevents problems with different formating.

Signed-off-by: Marco van Wieringen <marco.van.wieringen@bareos.com>
  • Loading branch information
joergsteffens authored and Marco van Wieringen committed Feb 17, 2015
1 parent 3ad449b commit 8364735
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion scripts/bareos-config-lib.sh.in
Expand Up @@ -246,7 +246,11 @@ get_database_param()
{
PARAM="$1"
DEFAULT="$2"
get_config_param "${CFG_DIR}" "catalog" "MyCatalog" "$PARAM" "$DEFAULT"
# DBCHECKS gets the database from the Director config file in a standard format,
# however, it writes "db_name" (like the environment variables)
# instead of "dbname" like in the config file.
# Replace "db_" by "db" to be compatible with the config file.
$DBCHECK | sed "s/^db_/db/" | sed -n "s/^${PARAM}=//p"
return $?
}

Expand Down

0 comments on commit 8364735

Please sign in to comment.