[jump req] Move pkg installation to lib.sh 63/53063/1
authorAlexandru Avadanii <Alexandru.Avadanii@enea.com>
Sun, 4 Mar 2018 02:50:01 +0000 (03:50 +0100)
committerAlexandru Avadanii <Alexandru.Avadanii@enea.com>
Sun, 4 Mar 2018 19:04:13 +0000 (20:04 +0100)
Change-Id: I687b73b256aca78c9d41d4bcd49bfbde51278b51
Signed-off-by: Alexandru Avadanii <Alexandru.Avadanii@enea.com>
ci/deploy.sh
mcp/scripts/lib.sh

index 344a87f..e07aca5 100755 (executable)
@@ -234,18 +234,7 @@ if [ ${USE_EXISTING_PKGS} -eq 1 ]; then
     notify "[NOTE] Skipping distro pkg installation" 2
 else
     notify "[NOTE] Installing required distro pkgs" 2
-    if [ -n "$(command -v apt-get)" ]; then
-      pkg_type='deb'; pkg_cmd='sudo apt-get install -y'
-    else
-      pkg_type='rpm'; pkg_cmd='sudo yum install -y --skip-broken'
-    fi
-    eval "$(parse_yaml "./requirements_${pkg_type}.yaml")"
-    for section in 'common' "$(uname -m)"; do
-      section_var="requirements_pkg_${section}[*]"
-      pkg_list+=" ${!section_var}"
-    done
-    # shellcheck disable=SC2086
-    ${pkg_cmd} ${pkg_list}
+    jumpserver_pkg_install
 fi
 
 if ! virsh list >/dev/null 2>&1; then
index e522fd6..e8edf95 100644 (file)
@@ -317,6 +317,21 @@ function prepare_vms {
   fi
 }
 
+function jumpserver_pkg_install {
+  if [ -n "$(command -v apt-get)" ]; then
+    pkg_type='deb'; pkg_cmd='sudo apt-get install -y'
+  else
+    pkg_type='rpm'; pkg_cmd='sudo yum install -y --skip-broken'
+  fi
+  eval "$(parse_yaml "./requirements_${pkg_type}.yaml")"
+  for section in 'common' "$(uname -i)"; do
+    section_var="requirements_pkg_${section}[*]"
+    pkg_list+=" ${!section_var}"
+  done
+  # shellcheck disable=SC2086
+  ${pkg_cmd} ${pkg_list}
+}
+
 function jumpserver_check_requirements {
   # shellcheck disable=SC2178
   local vnodes=$1; shift