xci: file: install-ansible.sh: Update script from latest Bifrost 77/46177/8
authorMarkos Chandras <mchandras@suse.de>
Tue, 24 Oct 2017 15:24:10 +0000 (17:24 +0200)
committerMarkos Chandras <mchandras@suse.de>
Fri, 17 Nov 2017 09:12:06 +0000 (09:12 +0000)
Update our own copy of the Ansible installation script to take some
Bifrost fixes into consideration. We also upgrade the pip and setuptools
to the latest available version if possible.

Change-Id: I5e51099b2698f0b03922d1364e83bc91cfadc00c
Signed-off-by: Markos Chandras <mchandras@suse.de>
xci/file/install-ansible.sh
xci/xci-deploy.sh

index 2661eea..75ae1d8 100644 (file)
@@ -7,34 +7,42 @@ set -eu
 
 declare -A PKG_MAP
 
+# workaround: for latest bindep to work, it needs to use en_US local
+export LANG=c
+
 CHECK_CMD_PKGS=(
+    gcc
     libffi
     libopenssl
+    lsb-release
+    make
     net-tools
     python-devel
+    python
+    venv
+    wget
 )
 
 source /etc/os-release || source /usr/lib/os-release
-
 case ${ID,,} in
     *suse)
     OS_FAMILY="Suse"
-    INSTALLER_CMD="sudo -H -E zypper install -y"
+    INSTALLER_CMD="sudo -H -E zypper install -y --no-recommends"
     CHECK_CMD="zypper search --match-exact --installed"
     PKG_MAP=(
         [gcc]=gcc
-        [git]=git
         [libffi]=libffi-devel
         [libopenssl]=libopenssl-devel
+        [lsb-release]=lsb-release
+        [make]=make
         [net-tools]=net-tools
         [python]=python
         [python-devel]=python-devel
         [venv]=python-virtualenv
         [wget]=wget
-        [openssl]=openssl
     )
     EXTRA_PKG_DEPS=( python-xml )
-    sudo zypper -n ref
+       sudo zypper -n ref
     # NOTE (cinerama): we can't install python without removing this package
     # if it exists
     if $(${CHECK_CMD} patterns-openSUSE-minimal_base-conflicts &> /dev/null); then
@@ -47,43 +55,45 @@ case ${ID,,} in
     export DEBIAN_FRONTEND=noninteractive
     INSTALLER_CMD="sudo -H -E apt-get -y install"
     CHECK_CMD="dpkg -l"
-    PKG_MAP=( [gcc]=gcc
-              [git]=git
-              [libffi]=libffi-dev
-              [libopenssl]=libssl-dev
-              [net-tools]=net-tools
-              [python]=python-minimal
-              [python-devel]=libpython-dev
-              [venv]=python-virtualenv
-              [wget]=wget
-              [openssl]=openssl
-            )
+    PKG_MAP=(
+        [gcc]=gcc
+        [libffi]=libffi-dev
+        [libopenssl]=libssl-dev
+        [lsb-release]=lsb-release
+        [make]=make
+        [net-tools]=net-tools
+        [python]=python-minimal
+        [python-devel]=libpython-dev
+        [venv]=python-virtualenv
+        [wget]=wget
+    )
     EXTRA_PKG_DEPS=()
-    sudo apt-get update
+       sudo apt-get update
     ;;
 
-    rhel|centos|fedora)
+    rhel|fedora|centos)
     OS_FAMILY="RedHat"
     PKG_MANAGER=$(which dnf || which yum)
     INSTALLER_CMD="sudo -H -E ${PKG_MANAGER} -y install"
     CHECK_CMD="rpm -q"
     PKG_MAP=(
         [gcc]=gcc
-        [git]=git
         [libffi]=libffi-devel
         [libopenssl]=openssl-devel
+        [lsb-release]=redhat-lsb
+        [make]=make
         [net-tools]=net-tools
         [python]=python
         [python-devel]=python-devel
         [venv]=python-virtualenv
         [wget]=wget
-        [openssl]=openssl
     )
     sudo yum updateinfo
     EXTRA_PKG_DEPS=()
-   ;;
+    sudo yum update --assumeno
+    ;;
 
-    *) echo "ERROR: Supported package manager not found.  Supported: apt,yum,zypper"; exit 1;;
+    *) echo "ERROR: Supported package manager not found.  Supported: apt, dnf, yum, zypper"; exit 1;;
 esac
 
 if ! $(python --version &>/dev/null); then
@@ -92,13 +102,14 @@ fi
 if ! $(gcc -v &>/dev/null); then
     ${INSTALLER_CMD} ${PKG_MAP[gcc]}
 fi
-if ! $(git --version &>/dev/null); then
-    ${INSTALLER_CMD} ${PKG_MAP[git]}
-fi
 if ! $(wget --version &>/dev/null); then
     ${INSTALLER_CMD} ${PKG_MAP[wget]}
 fi
 
+if ! $(python -m virtualenv --version &>/dev/null); then
+    ${INSTALLER_CMD} ${PKG_MAP[venv]}
+fi
+
 for pkg in ${CHECK_CMD_PKGS[@]}; do
     if ! $(${CHECK_CMD} ${PKG_MAP[$pkg]} &>/dev/null); then
         ${INSTALLER_CMD} ${PKG_MAP[$pkg]}
@@ -143,7 +154,9 @@ if ! which pip; then
 fi
 
 PIP=$(which pip)
-
-${PIP} install --user "pip>6.0"
-
+echo "Using pip: $(${PIP} --version)"
+sudo -H -E ${PIP} install --upgrade virtualenv
+sudo -H -E ${PIP} install --upgrade pip
+# upgrade setuptools, as latest version is needed to install some projects
+sudo -H -E ${PIP} install --upgrade setuptools
 ${PIP} install --user --upgrade ansible==$XCI_ANSIBLE_PIP_VERSION
index 7d29945..9264985 100755 (executable)
@@ -91,7 +91,10 @@ echo "-------------------------------------------------------------------------"
 #-------------------------------------------------------------------------------
 # Install ansible on localhost
 #-------------------------------------------------------------------------------
+echo "Info: Installing Ansible from pip"
+echo "-------------------------------------------------------------------------"
 source file/install-ansible.sh
+echo "-------------------------------------------------------------------------"
 
 # Make the VMs match the host. If we need to make this configurable
 # then this logic has to be moved outside this file