MT#15141 Add check for merge failures

Change-Id: Id078f26296208a0dac2112e9f2a0066dbe835984
changes/54/2654/5
Alexander Lutay 11 years ago committed by Victor Seva
parent 776a4da7b3
commit 986030b1f2

@ -9,12 +9,12 @@ set -u
FUNCTIONS="${FUNCTIONS:-/usr/share/ngcp-ngcpcfg/functions/}"
HELPER="${HELPER:-/usr/share/ngcp-ngcpcfg/helper/}"
if ! [ -r ${FUNCTIONS}/main ] ; then
printf "Error: ${FUNCTIONS}/main could not be read. Exiting.\n" >&2
if ! [ -r "${FUNCTIONS}"/main ] ; then
printf "Error: %s/main could not be read. Exiting.\n" "${FUNCTIONS}" >&2
exit 1
fi
. ${FUNCTIONS}/main
. "${FUNCTIONS}"/main
check_config_encoding() {
log_debug "Checking encoding for $config_files"
@ -58,7 +58,8 @@ validate_config() {
log_debug "Validating schema for main YAML files"
for f in $config_files ; do
local schema="/usr/share/ngcp-cfg-schema/validate/$(basename "${f}")"
local schema
schema="/usr/share/ngcp-cfg-schema/validate/$(basename "${f}")"
if ! [ -f "${schema}" ] ; then
continue
@ -81,6 +82,18 @@ validate_config() {
fi
}
check_configs_conflicts() {
log_info "Checking merge conflicts in ngcp configs:"
if grep -rP --exclude-dir='.git' --exclude='*.dpkg-*' \
'^>>>>>>> [0-9a-fA-F]+' /etc/ngcp-config/ 2>&1
then
log_error "ERROR: ngcp configs with Git merge conflicts found."
exit 1
else
log_info "No ngcp configs with merge conflicts found."
fi
}
if [ "$*" = "" ] ; then
config_files="${NGCPCTL_CONFIG:-} ${HOST_CONFIG:-} ${LOCAL_CONFIG:-} ${NETWORK_CONFIG:-} ${EXTRA_CONFIG_FILES:-} ${CONSTANTS_CONFIG:-}"
else
@ -91,6 +104,7 @@ check_configs
if "${VALIDATE_SCHEMA:-false}" ; then
validate_config
fi
check_configs_conflicts
exit 0

Loading…
Cancel
Save