aboutsummaryrefslogtreecommitdiffstats
path: root/juju
diff options
context:
space:
mode:
authorHarry Huang <huangxiangyu5@huawei.com>2017-02-06 18:15:54 +0800
committerHarry Huang <huangxiangyu5@huawei.com>2017-02-08 13:23:22 +0800
commit68f25c4b7147de79126c1cd8565cac1423967e45 (patch)
tree192e84fae6d49d90d1f4f7d372a347ca64933d7c /juju
parent1eb8d4ccfbc9c34723586980d5a912e2ffa903cd (diff)
Fix ssh bug
Bug reported from Opera Jenkins. Since a new POD is used, ssh key is not generated before which cause fail when creating openstack key for jump host. This bug may happens on every machine never generates ssh key before. Change-Id: Iebae3f17327d64eb1cc45df1015cd21eb12fb397 Signed-off-by: Harry Huang <huangxiangyu5@huawei.com>
Diffstat (limited to 'juju')
-rwxr-xr-xjuju/adapter.sh2
-rwxr-xr-xjuju/juju_launch.sh18
-rwxr-xr-xjuju/juju_setup.sh4
3 files changed, 18 insertions, 6 deletions
diff --git a/juju/adapter.sh b/juju/adapter.sh
index f4c2d52..2f1d8f7 100755
--- a/juju/adapter.sh
+++ b/juju/adapter.sh
@@ -19,7 +19,7 @@ function generate_compass_openrc()
PUBLIC_VIP=$(eval "$exec_command $cmd")
echo -e "export OS_PASSWORD=console \n\
-export OS_TENANT_NAME=admin \n\
+export OS_PROJECT_NAME=admin \n\
export OS_AUTH_URL=http://$PUBLIC_VIP:35357/v2.0 \n\
export OS_USERNAME=admin \n\
export OS_VOLUME_API_VERSION=2 \n\
diff --git a/juju/juju_launch.sh b/juju/juju_launch.sh
index 10a35bb..a4cf604 100755
--- a/juju/juju_launch.sh
+++ b/juju/juju_launch.sh
@@ -24,11 +24,19 @@ function launch_juju_vm()
--key-name jump-key --security-group juju-default juju-metadata-vm
fi
+ count=300
set +x
- until [[ $(nova list | grep juju-metadata-vm | grep ACTIVE) ]]
- do
- sleep 1
- done
+ while
+ state1=$(nova list | grep juju-client-vm | awk '{print $6}')
+ state2=$(nova list | grep juju-metadata-vm | awk '{print $6}')
+ if [[ $state1 == "ERROR" || $state2 == "ERROR" || $count == 0 ]]; then
+ log_error "launch juju vm error"
+ exit 1
+ fi
+ let count-=1
+ sleep 2
+ [[ $state1 != "ACTIVE" || $state2 != "ACTIVE" ]]
+ do :;done
set -x
if [ ! $(nova list | grep juju-client-vm | awk '{print $14}') ]; then
@@ -108,7 +116,7 @@ function juju_client_prepare()
openstack:
auth-type: userpass
password: $OS_PASSWORD
- tenant-name: $OS_TENANT_NAME
+ tenant-name: $OS_PROJECT_NAME
username: $OS_USERNAME' > os-creds.yaml"
# credential uses keystone url V3
diff --git a/juju/juju_setup.sh b/juju/juju_setup.sh
index 61e0152..dc8e99b 100755
--- a/juju/juju_setup.sh
+++ b/juju/juju_setup.sh
@@ -79,6 +79,10 @@ function juju_prepare()
--remote-ip-prefix 0.0.0.0/0 juju-default
fi
+ if [ ! -f ~/.ssh/id_rsa.pub ]; then
+ ssh-keygen -q -t rsa -f ~/.ssh/id_rsa -N ""
+ fi
+
openstack keypair list | grep 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