From e218928a60fb91f714dcad885923febb63765950 Mon Sep 17 00:00:00 2001 From: Alexander Lutay Date: Mon, 16 Jul 2018 16:13:50 +0200 Subject: [PATCH] TT#38453 Fix f95eeb2: skip new check_origin() on installer stage Otherwise ngcp-installer failed to install PRO/Carrier as we build the file /etc/ngcp_mgmt_node the very first time on the first MGMT node: > +08:22:48 cfg_build_templates > +08:22:48 cfg_build_configs /etc/ngcp_mgmt_node > +08:22:48 build_configs=($1) > +08:22:48 declare -a build_configs > +08:22:48 log_info 'Generating default configuration files /etc/ngcp_mgmt_node' > +08:22:48 tee -a /tmp/ngcp-installer.log > +08:22:48 echo 'Generating default configuration files /etc/ngcp_mgmt_node' > Generating default configuration files /etc/ngcp_mgmt_node > +08:22:48 ngcpcfg build /etc/ngcp_mgmt_node > cat: /etc/ngcp_mgmt_node: No such file or directory > +08:22:48 log_die 'Error running '\''ngcpcfg build'\''' Checking the file availability is not enough here, the next error is: > (sp1)root@sp1:/# ngcpcfg build > /usr/share/ngcp-ngcpcfg/scripts//check: line 83: NGCP_IS_MGMT: unbound variable > (sp1)root@sp1:/# cat /etc/default/ngcp-roles > NGCP_TYPE="sppro" > (sp1)root@sp1:/# It happens because /etc/default/ngcp-roles is a fake one at this stage. Handling NGCP_IS_MGMT properly is also not enough: > (sp1)root@sp1:/# ngcpcfg build > 2018-07-16 16:49:32: Error: Remote origin of ngcpcfg is '/mnt/glusterfs/ngcpcfg-share', expected: 'sp:/mnt/glusterfs/ngcpcfg-share'. > 2018-07-16 16:49:32: Error: NOTE: execute `cd /etc/ngcp-config ; git remote set-url origin 'sp:/mnt/glusterfs/ngcpcfg-share'` to adjust setting. > 2018-07-16 16:49:32: Error: NOTE: perform `ngcpcfg clean --all` to recreate local master branch from remote. > (sp1)root@sp1:/# Which happens because the peer is not yet configured at the moment (first node installation). Introducing new internal option '--no-check-origin' to skip the test into installer. Change-Id: I0265c65f45972e92ca92320871a7ef29f8904fec --- sbin/ngcpcfg | 1 + scripts/check | 5 +++++ 2 files changed, 6 insertions(+) diff --git a/sbin/ngcpcfg b/sbin/ngcpcfg index e6eaaac7..3c4d91f9 100755 --- a/sbin/ngcpcfg +++ b/sbin/ngcpcfg @@ -126,6 +126,7 @@ case ${1:-} in --no-db-sync) export NO_DB_SYNC=1 ; shift ; "$0" "$@" ;; --no-validate) export NO_VALIDATE=1; shift ; "$0" "$@" ;; --no-action-failure) export NO_ACTION_FAILURE=1; shift ; "$0" "$@" ;; + --no-check-origin) export NO_CHECK_ORIGIN=1; shift ; "$0" "$@" ;; --validate) export VALIDATE=1; shift ; "$0" "$@" ;; -h|--help|help) usage ; exit 0;; -v|--version|version) version ; exit 0;; diff --git a/scripts/check b/scripts/check index 6aace397..bf491c57 100755 --- a/scripts/check +++ b/scripts/check @@ -52,6 +52,11 @@ check_origin() { return 0 fi + if [ "${NO_CHECK_ORIGIN:-}" = "1" ] ; then + log_debug "Skipping check_origin (NO_CHECK_ORIGIN=1)." + return 0 + fi + log_debug "check_origin" log_debug "cd ${NGCPCTL_MAIN}"