diff options
-rw-r--r-- | conf/test.py | 6 | ||||
-rwxr-xr-x | juju/adapter.sh | 2 | ||||
-rwxr-xr-x | juju/juju_launch.sh | 18 | ||||
-rwxr-xr-x | juju/juju_setup.sh | 4 |
4 files changed, 18 insertions, 12 deletions
diff --git a/conf/test.py b/conf/test.py deleted file mode 100644 index 0a45a94..0000000 --- a/conf/test.py +++ /dev/null @@ -1,6 +0,0 @@ - -a={'a':'1.2','b':'1.1','c':'1.0'} -b=sorted(a.items(),key=lambda i:i[1]) -c=[i[0] for i in b] -#sorted(b, cmp=lambda x,y: cmp(a[x],a[y])) -print c 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 |