diff options
author | Harry Huang <huangxiangyu5@huawei.com> | 2017-03-27 11:53:39 +0800 |
---|---|---|
committer | Harry Huang <huangxiangyu5@huawei.com> | 2017-03-27 14:11:21 +0800 |
commit | 7ee5c95db62d13d860d51974aa9c0a14404cee56 (patch) | |
tree | 8b8c36e9fef50ace481694cd1933566048755a6d /juju/juju_setup.sh | |
parent | 654e20848b723541c17d56cf16518db87e14f7ae (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>
Diffstat (limited to 'juju/juju_setup.sh')
-rwxr-xr-x | juju/juju_setup.sh | 17 |
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 |