TT#15824 Update code based on comments from previous code review

Change-Id: Ic5adbb93eb7fc908c013f257321e82a67d61fbf1
changes/44/13144/2
Alexander Lutay 9 years ago
parent 6e554b5717
commit 150d2a5e2e

@ -17,6 +17,11 @@ CONFIG_POOL="${CONFIG_POOL:-/etc}"
FUNCTIONS="${FUNCTIONS:-/usr/share/ngcp-ngcpcfg/functions/}"
HELPER="${HELPER:-/usr/share/ngcp-ngcpcfg/helper/}"
if ! [ -r "${FUNCTIONS}"/main ] ; then
printf "Error: %s/main could not be read. Exiting.\n" "${FUNCTIONS}" >&2
exit 1
fi
. "${FUNCTIONS}"/main
# main script

@ -17,13 +17,18 @@ if [ $COUNT -le 0 ] ; then
exit 1
fi
if ! [ -x /usr/sbin/mysqld ] || ! [ -x /usr/bin/mysqladmin ] ; then
echo "Error: mysqld or mysqladmin not present. Exiting." >&2
if ! which mysqld >/dev/null 2>&1 ; then
echo "Error: mysqld is not present. Exiting." >&2
exit 1
fi
if ! which mysqladmin >/dev/null 2>&1 ; then
echo "Error: mysqladmin is not present. Exiting." >&2
exit 1
fi
mysqld_get_param() {
/usr/sbin/mysqld --defaults-group-suffix=$SUFF --print-defaults 2>/dev/null \
mysqld --defaults-group-suffix=$SUFF --print-defaults 2>/dev/null \
| tr " " "\n" \
| grep -- "--$1" \
| tail -n 1 \
@ -31,7 +36,7 @@ mysqld_get_param() {
}
mysqld_status () {
if /usr/bin/mysqladmin --defaults-group-suffix=$SUFF \
if mysqladmin --defaults-group-suffix=$SUFF \
--defaults-file=/etc/mysql/debian.cnf ping 2>&1 ; then
ping_alive=1
else

@ -22,6 +22,10 @@ if "${SKIP_NGCP_FUNCTIONS}" ; then
log_errror () { echo "$@" >&2 ; }
log_warn () { echo "$@" ; }
else
if ! [ -r "${FUNCTIONS}"/main ] ; then
printf "Error: %s/main could not be read. Exiting.\n" "${FUNCTIONS}" >&2
exit 1
fi
. "${FUNCTIONS}/main"
fi

@ -81,12 +81,12 @@ else
done
fi
if git diff-index --name-only HEAD | grep \
-qe "$(basename "$NGCPCTL_CONFIG")" \
-qe "$(basename "$HOST_CONFIG")" \
-qe "$(basename "$LOCAL_CONFIG")" \
-qe "$(basename "$NETWORK_CONFIG")" \
-qe "$(basename "$CONSTANTS_CONFIG")" ; then
if git diff-index --name-only HEAD | grep -q \
-e "$(basename "$NGCPCTL_CONFIG")" \
-e "$(basename "$HOST_CONFIG")" \
-e "$(basename "$LOCAL_CONFIG")" \
-e "$(basename "$NETWORK_CONFIG")" \
-e "$(basename "$CONSTANTS_CONFIG")" ; then
log_debug "modification in main configuration file found"
trigger_rebuild=true
fi

@ -6,12 +6,18 @@ set -e
set -u
set -o pipefail
if ! [ -r /usr/share/ngcp-ngcpcfg/functions/main ] ; then
printf "Error: /usr/share/ngcp-ngcpcfg/functions/main could not be read. Exiting.\n" >&2
# support testsuite
FUNCTIONS="${FUNCTIONS:-/usr/share/ngcp-ngcpcfg/functions/}"
HELPER="${HELPER:-/usr/share/ngcp-ngcpcfg/helper/}"
SCRIPTS="${SCRIPTS:-/usr/share/ngcp-ngcpcfg/scripts/}"
if ! [ -r "${FUNCTIONS}"/main ] ; then
printf "Error: %s/main could not be read. Exiting.\n" "${FUNCTIONS}" >&2
exit 1
fi
. /usr/share/ngcp-ngcpcfg/functions/main
timestamp_replacementchars=''
. "${FUNCTIONS}"/main
# main script
log_debug "cd $NGCPCTL_MAIN"

Loading…
Cancel
Save