summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorcarey.xu <carey.xuhan@huawei.com>2016-01-27 11:21:41 +0800
committercarey.xu <carey.xuhan@huawei.com>2016-01-27 11:21:41 +0800
commit419efdec1f8f6b95580750c684fa1050dd170a9b (patch)
treefa3c90f88544dc0f2ba1e351d465533f394d1be3
parent98640927866337bfd6637e250d4c28d3460dfcf1 (diff)
bugfix: prepare python venv
JIRA: bugfix_python_env Change-Id: Ie7f3e295c7c283ff3e805bed13029174c2dda258 Signed-off-by: carey.xu <carey.xuhan@huawei.com>
-rwxr-xr-xdeploy.sh5
-rwxr-xr-xdeploy/compass_vm.sh2
-rwxr-xr-xdeploy/launch.sh3
-rwxr-xr-xdeploy/prepare.sh26
4 files changed, 22 insertions, 14 deletions
diff --git a/deploy.sh b/deploy.sh
index 95c3276d..8e05a8e2 100755
--- a/deploy.sh
+++ b/deploy.sh
@@ -8,9 +8,4 @@ if [[ -z $DEPLOY_COMPASS && -z $DEPLOY_HOST && -z $REDEPLOY_HOST ]]; then
export DEPLOY_HOST="true"
fi
-sudo apt-get install -y --force-yes python-pip
-sudo pip install --upgrade pip
-sudo pip install --upgrade cheetah
-sudo pip install --upgrade pyyaml
-
$COMPASS_DIR/deploy/launch.sh $*
diff --git a/deploy/compass_vm.sh b/deploy/compass_vm.sh
index 196df4a3..394d7c50 100755
--- a/deploy/compass_vm.sh
+++ b/deploy/compass_vm.sh
@@ -32,7 +32,7 @@ function install_compass() {
local inventory_file=$compass_vm_dir/inventory.file
sed -i "s/mgmt_next_ip:.*/mgmt_next_ip: ${COMPASS_SERVER}/g" $WORK_DIR/installer/compass-install/install/group_vars/all
echo "compass_nodocker ansible_ssh_host=$MGMT_IP ansible_ssh_port=22" > $inventory_file
- PYTHONUNBUFFERED=1 ANSIBLE_FORCE_COLOR=true ANSIBLE_HOST_KEY_CHECKING=false ANSIBLE_SSH_ARGS='-o UserKnownHostsFile=/dev/null -o ControlMaster=auto -o ControlPersist=60s' python /usr/local/bin/ansible-playbook -e pipeline=true --private-key=$rsa_file --user=root --connection=ssh --inventory-file=$inventory_file $WORK_DIR/installer/compass-install/install/$1
+ PYTHONUNBUFFERED=1 ANSIBLE_FORCE_COLOR=true ANSIBLE_HOST_KEY_CHECKING=false ANSIBLE_SSH_ARGS='-o UserKnownHostsFile=/dev/null -o ControlMaster=auto -o ControlPersist=60s' ansible-playbook -e pipeline=true --private-key=$rsa_file --user=root --connection=ssh --inventory-file=$inventory_file $WORK_DIR/installer/compass-install/install/$1
exit_status=$?
rm $inventory_file
if [[ $exit_status != 0 ]];then
diff --git a/deploy/launch.sh b/deploy/launch.sh
index b9e47693..d8e20f09 100755
--- a/deploy/launch.sh
+++ b/deploy/launch.sh
@@ -4,6 +4,8 @@ WORK_DIR=$COMPASS_DIR/work/deploy
mkdir -p $WORK_DIR/script
+source ${COMPASS_DIR}/deploy/prepare.sh
+prepare_python_env
source ${COMPASS_DIR}/util/log.sh
source ${COMPASS_DIR}/deploy/deploy_parameter.sh
source $(process_input_para $*) || exit 1
@@ -12,7 +14,6 @@ source ${COMPASS_DIR}/deploy/conf/${FLAVOR}.conf
source ${COMPASS_DIR}/deploy/conf/${TYPE}.conf
source ${COMPASS_DIR}/deploy/conf/base.conf
source ${COMPASS_DIR}/deploy/conf/compass.conf
-source ${COMPASS_DIR}/deploy/prepare.sh
source ${COMPASS_DIR}/deploy/network.sh
source ${COMPASS_DIR}/deploy/host_${TYPE}.sh
source ${COMPASS_DIR}/deploy/compass_vm.sh
diff --git a/deploy/prepare.sh b/deploy/prepare.sh
index db410917..a85be6fb 100755
--- a/deploy/prepare.sh
+++ b/deploy/prepare.sh
@@ -33,19 +33,14 @@ function prepare_env() {
sudo apt-get install -y --force-yes mkisofs bc curl ipmitool openvswitch-switch
sudo apt-get install -y --force-yes git python-dev
sudo apt-get install -y --force-yes libxslt-dev libxml2-dev libvirt-dev build-essential qemu-utils qemu-kvm libvirt-bin virtinst libmysqld-dev
- sudo pip install --upgrade ansible==1.9.4
- sudo pip install --upgrade virtualenv
- sudo pip install --upgrade netaddr
- sudo apt-get install python-oslo.config
sudo service libvirt-bin restart
# prepare work dir
- rm -rf $WORK_DIR/{installer,vm,network,iso,venv}
+ rm -rf $WORK_DIR/{installer,vm,network,iso}
mkdir -p $WORK_DIR/installer
mkdir -p $WORK_DIR/vm
mkdir -p $WORK_DIR/network
mkdir -p $WORK_DIR/iso
- mkdir -p $WORK_DIR/venv
mkdir -p $WORK_DIR/cache
download_iso
@@ -61,7 +56,24 @@ function prepare_env() {
rm -rf $WORK_DIR/mnt
chmod 755 $WORK_DIR -R
- virtualenv $WORK_DIR/venv
sudo cp ${COMPASS_DIR}/deploy/qemu_hook.sh /etc/libvirt/hooks/qemu
}
+
+function prepare_python_env() {
+ rm -rf $WORK_DIR/venv
+ mkdir -p $WORK_DIR/venv
+
+ sudo apt-get install -y --force-yes python-pip
+ sudo pip install --upgrade virtualenv
+ virtualenv $WORK_DIR/venv
+ source $WORK_DIR/venv/bin/activate
+
+ pip install --upgrade pip
+ pip install --upgrade cheetah
+ pip install --upgrade pyyaml
+ pip install --upgrade requests
+ pip install --upgrade netaddr
+ pip install --upgrade oslo.config
+ pip install --upgrade ansible==1.9.4
+}