Skip to content

Commit

Permalink
handle unset parameter
Browse files Browse the repository at this point in the history
  • Loading branch information
joergsteffens committed Apr 24, 2014
1 parent ab2a179 commit ff640c8
Showing 1 changed file with 17 additions and 17 deletions.
34 changes: 17 additions & 17 deletions scripts/bareos-config-lib.sh.in
Expand Up @@ -36,7 +36,7 @@ os_type=`uname -s`

is_function()
{
func=$1
func=${1-}
test "$func" && type "$func" > /dev/null 2>&1
return $?
}
Expand Down Expand Up @@ -119,7 +119,7 @@ get_database_ddl_dir()

get_database_utility_path()
{
db_type="$1"
db_type="${1-}"

case ${db_type} in
sqlite3)
Expand Down Expand Up @@ -217,15 +217,15 @@ get_config_param()
#

# configuration file
CFG_FILE="$1"
CFG_FILE="${1-}"
# section, currently ignored
SECTION="$2"
SECTION="${2-}"
# name of the section, currently ignored
NAME="$3"
NAME="${3-}"
# parameter to get from config file
PARAM="$4"
PARAM="${4-}"
# default value, if parameter is not found
DEFAULT="$5"
DEFAULT="${5-}"

if ! [ -r "${CFG_FILE}" ]; then
warn "failed to get parameter ${SECTION} ${NAME} ${PARAM}: can't read ${CFG_FILE}"
Expand All @@ -244,8 +244,8 @@ get_config_param()

get_database_param()
{
PARAM="$1"
DEFAULT="$2"
PARAM="${1-}"
DEFAULT="${2-}"

DBCHECK_OUTPUT=`$DBCHECK`
rc=$?
Expand Down Expand Up @@ -279,28 +279,28 @@ get_database_param()

get_database_driver()
{
DEFAULT="$1"
DEFAULT="${1-}"
get_database_param "dbdriver" "$DEFAULT" | grep -v "XXX_REPLACE_WITH_DATABASE_DRIVER_XXX"
return $?
}

get_database_name()
{
DEFAULT="$1"
DEFAULT="${1-}"
get_database_param "dbname" "$DEFAULT"
return $?
}

get_database_user()
{
DEFAULT="$1"
DEFAULT="${1-}"
get_database_param "dbuser" "$DEFAULT"
return $?
}

get_database_password()
{
DEFAULT="$1"
DEFAULT="${1-}"
get_database_param "dbpassword" "$DEFAULT"
return $?
}
Expand Down Expand Up @@ -337,7 +337,7 @@ initialize_database_driver()

is_template_sql_file()
{
input_file=$1
input_file=${1-}

if [ -z "${input_file}" ]; then
return 1
Expand All @@ -357,7 +357,7 @@ get_translated_sql_file()
# replaces variables in a SQL DDL file
# and returns the result as stdout.

input_file=$1
input_file=${1-}

if [ -z "${input_file}" ]; then
return 1
Expand Down Expand Up @@ -412,8 +412,8 @@ get_database_grant_priviliges()

#db_name="$1"
db_type="${1:-${db_type:-`get_database_driver_default`}}"
db_user="$2"
db_password="$3"
db_user="${2-}"
db_password="${3-}"
case "$4" in
"")
# full access
Expand Down

0 comments on commit ff640c8

Please sign in to comment.