summaryrefslogtreecommitdiffstats
path: root/docker/config_install_env.sh
blob: ed67994f09f479ca3ff87156d1bf2521fb6b5ec1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
#!/bin/bash

set -e

PIP_PATH=~/.pip
PIP_CONF=$PIP_PATH/pip.conf
EASY_INSTALL_CONF=~/.pydistutil.cfg

if [ "x$BASE_PIP_URL" = "x" ];then
    exit 0
fi

echo "config pip and easy_install"
HOSTNAME=`echo $BASE_PIP_URL | awk -F '[:/]' '{print $4}'`
if [ "x$HOSTNAME" = "x" ]; then
    echo "invalid BASE_PIP_URL: $BASE_PIP_URL"
    exit 1
fi

if [ ! -d $PIP_PATH ];then
    mkdir $PIP_PATH
fi

echo -e "[global]\ntrusted-host = $HOSTNAME\nindex-url = $BASE_PIP_URL\ntimeout = 6000" > $PIP_CONF
echo -e "[easy_install]\nindex-url = $BASE_PIP_URL\nfind-links = $BASE_PIP_URL" > $EASY_INSTALL_CONF
ss="si">}" && echo "[wait_for] OK: ${cmdstr}" && return 0 || true else ! (eval "${cmdstr}" || echo 'No response') |& tee /dev/stderr | \ grep -Eq '(Not connected|No response)' && \ echo "[wait_for] OK: ${cmdstr}" && return 0 || true fi sleep "${sleep_time}" done echo "[wait_for] ERROR: Failed after max attempts: ${cmdstr}" return 1 ) } function cleanup_uefi { # Clean up Ubuntu boot entry if cfg01, kvm nodes online from previous deploy local cmd_str="ssh ${SSH_OPTS} ${SSH_SALT}" ping -c 1 -w 1 "${SALT_MASTER}" || return 0 [ ! "$(hostname)" = 'cfg01' ] || cmd_str='eval' # NOTE: Targeting nodes by hostname is fragile and should be refactored to # also cover corner cases like noha scenarios on AArch64 baremetal's 'ctl01' ${cmd_str} "sudo salt -C 'kvm* or cmp*' cmd.run \ \"which efibootmgr > /dev/null 2>&1 && \ efibootmgr | grep -oP '(?<=Boot)[0-9]+(?=.*ubuntu)' | \ xargs -I{} efibootmgr --delete-bootnum --bootnum {}; \ rm -rf /boot/efi/*\"" || true } function get_nova_compute_pillar_data { local value=$(salt -C 'I@nova:compute and *01*' pillar.get _param:"${1}" --out yaml | cut -d ' ' -f2) if [ "${value}" != "''" ]; then echo "${value}" fi }