From 6b833f7f318c3f43c56c37c4430a2b309ed66544 Mon Sep 17 00:00:00 2001 From: Manuel Montecelo Date: Fri, 8 Mar 2019 14:09:53 +0100 Subject: [PATCH] TT#44854 Add option --ignore-shared-storage-check for "build" and "check" This is necessary when the HA_INT addresses are being changed, the communication is not possible in that scenario. Change-Id: I658a4f40e4f5b13d6ac224978999789728d8b915 --- docs/ngcpcfg.txt | 11 +++++++++-- scripts/build | 11 ++++------- scripts/check | 10 +++++++++- 3 files changed, 22 insertions(+), 10 deletions(-) diff --git a/docs/ngcpcfg.txt b/docs/ngcpcfg.txt index bcb80e01..2b2bc3f5 100644 --- a/docs/ngcpcfg.txt +++ b/docs/ngcpcfg.txt @@ -285,15 +285,18 @@ provides useful information. The *--force-all-services* option causes all services to be restarted, including services without changes in config files. - **check** [--ignore-branch-check] [|]:: + **check** [--ignore-branch-check] [--ignore-shared-storage-check] [|]:: Check syntax of YAML files and validate schema before performing any further actions. The *--ignore-branch-check* option doesn't fail the check if the current active branch doesn't match 'master'. +The option *--ignore-shared-storage-check* can be used to skip check of shared +storage, for example in situations like when the HA_INT addresses are being +changed, because the communication is not possible in that scenario. In the High Availability setup possibly outstanding pull actions are checked as well. - **build** [--ignore-branch-check] [--modified-only] [|]:: + **build** [--ignore-branch-check] [--ignore-shared-storage-check] [--modified-only] [|]:: Generate configuration files, based on values defined the central yml files and based on the templates in the configuration tree (/etc/ngcp-config/templates by @@ -302,6 +305,10 @@ _check_ action. The *--modified-only* option checks for _modified_ and _uncommit configuration files (central yml files and templates) and builds the relevant files only. The *--ignore-branch-check* option doesn't fail the build if the current active branch doesn't match 'master'. +The option *--ignore-shared-storage-check* can be used to pass down to the +"check" subcommand in order to skip check of shared storage, for example in +situations like when the HA_INT addresses are being changed, because the +communication is not possible in that scenario. If a central yml file is modified it builds all configuration files. If changes are in template files only just the according template files are considered for rebuild. If a file (e.g. _/etc/rsyslog.conf_) or directory (e.g. diff --git a/scripts/build b/scripts/build index 8e294d87..c5d5cec1 100755 --- a/scripts/build +++ b/scripts/build @@ -19,22 +19,19 @@ fi . "${FUNCTIONS}"/main MODIFIED_ONLY=false -CHECK_BRANCH=true +check_args=() if [ -n "${1:-}" ] ; then case "$1" in *--modified-only*) MODIFIED_ONLY=true ; shift ;; - *--ignore-branch-check*) CHECK_BRANCH=false ; shift ;; + *--ignore-branch-check*) check_args+=( --ignore-branch-check ) ; shift ;; + *--ignore-shared-storage-check*) check_args+=( --ignore-shared-storage-check ) ; shift ;; esac fi # Sanity check the YAML and schema files. # NOTE: we can't blindly pass "$@" to the check script, # so explicitly check and add option as needed -if "$CHECK_BRANCH" ; then - "${SCRIPTS}"/check -else - "${SCRIPTS}"/check --ignore-branch-check -fi +"${SCRIPTS}"/check "${check_args[@]}" "${SCRIPTS}"/patch "$@" diff --git a/scripts/check b/scripts/check index bf491c57..f3e67b71 100755 --- a/scripts/check +++ b/scripts/check @@ -19,13 +19,16 @@ fi usage() { printf "ngcpcfg build -- supported command line options: ---ignore-branch-check - do not fail build if branch doesn't match 'master'\n\n" +--ignore-branch-check - do not fail build if branch doesn't match 'master' +--ignore-shared-storage-check - skip check of shared storage\n\n" } CHECK_BRANCH=true +CHECK_SHARED_STORAGE=true while [ -n "${1:-}" ] ; do case "$1" in *--ignore-branch-check*) CHECK_BRANCH=false ; shift ;; + *--ignore-shared-storage-check*) CHECK_SHARED_STORAGE=false ; shift ;; *--help*) usage ; exit 0 ;; *) break ;; esac @@ -192,6 +195,11 @@ check_configs_conflicts() { } check_shared_storage() { + if ! ${CHECK_SHARED_STORAGE} ; then + log_info "Option --ignore-shared-storage-check is enabled, skipping." + return 0 + fi + # ensure there are no outstanding pull actions, # unless --no-action-failure is used (ignore then) if ! type -p execute_check_shared_storage &>/dev/null ; then