summaryrefslogtreecommitdiffstats
path: root/juju/juju_setup.sh
diff options
context:
space:
mode:
authorHarry Huang <huangxiangyu5@huawei.com>2017-03-27 11:53:39 +0800
committerYingjun Li <yingjun.li@huawei.com>2017-03-27 06:54:47 +0000
commit5a9cd98783bf7547cb56b3da84521315d3354f21 (patch)
tree6c96bc8d7d3666ca6509d73285f69dbb95a29ddb /juju/juju_setup.sh
parenta10160eb86f804a9daafdf156812c6b90f1b01a3 (diff)
run without sudo
Jenkins can't remove some dir generate by sudo and leads to CI error for following tasks. Change codes to run ./opera_launch.sh without sudo Change-Id: Iaebd7e1fbdf413a91cc55c77e1b5c6915cfc86d6 Signed-off-by: Harry Huang <huangxiangyu5@huawei.com> (cherry picked from commit 7ee5c95db62d13d860d51974aa9c0a14404cee56)
Diffstat (limited to 'juju/juju_setup.sh')
-rwxr-xr-xjuju/juju_setup.sh17
1 files changed, 8 insertions, 9 deletions
diff --git a/juju/juju_setup.sh b/juju/juju_setup.sh
index eb49360..5d69c72 100755
--- a/juju/juju_setup.sh
+++ b/juju/juju_setup.sh
@@ -13,8 +13,8 @@ CSAR_DIR=${WORK_DIR}/csar
function juju_env_prepare()
{
- sudo rm -f /root/.ssh/known_hosts
- sudo rm -f /root/.ssh/known_hosts.old
+ rm -f ~/.ssh/known_hosts
+ rm -f ~/.ssh/known_hosts.old
mkdir -p ${WORK_DIR}/venv
sudo pip install --upgrade virtualenv
@@ -54,12 +54,11 @@ function juju_prepare()
done
wget -nc -O $IMG_DIR/$JUJU_VM_IMG $JUJU_VM_IMG_URL
- if [[ $(glance image-list | grep $JUJU_VM_IMG) ]]; then
- openstack image delete $JUJU_VM_IMG
+ if [[ ! $(glance image-list | grep $JUJU_VM_IMG) ]]; then
+ glance image-create --name=$JUJU_VM_IMG \
+ --disk-format qcow2 --container-format=bare \
+ --visibility=public --file $IMG_DIR/$JUJU_VM_IMG
fi
- glance image-create --name=$JUJU_VM_IMG \
- --disk-format qcow2 --container-format=bare \
- --visibility=public --file $IMG_DIR/$JUJU_VM_IMG
mkdir -p $CSAR_DIR
for((i=0;i<${#CSAR_NAME[@]};i++))
@@ -114,10 +113,10 @@ function juju_prepare()
--remote-ip-prefix 0.0.0.0/0 $default_secgroup_id
fi
- echo -e 'n\n'|ssh-keygen -q -t rsa -N "" -f /root/.ssh/id_rsa 1>/dev/null
+ echo -e 'n\n' | ssh-keygen -q -t rsa -N "" -f ~/.ssh/id_rsa 1>/dev/null
openstack keypair delete jump-key | true
- openstack keypair create --public-key /root/.ssh/id_rsa.pub jump-key
+ openstack keypair create --public-key ~/.ssh/id_rsa.pub jump-key
openstack flavor show m1.tiny || openstack flavor create --ram 512 --disk 5 --vcpus 1 --public m1.tiny
openstack flavor show m1.small || openstack flavor create --ram 1024 --disk 10 --vcpus 1 --public m1.small