summaryrefslogtreecommitdiffstats
path: root/juju/configure-juju-on-openstack
diff options
context:
space:
mode:
authorNarinder Gupta <narinder.gupta@canonical.com>2016-07-29 12:46:28 -0500
committerNarinder Gupta <narinder.gupta@canonical.com>2016-07-29 12:46:52 -0500
commit4265e70fa9218498d058c4e81c73dab6265b54da (patch)
treea8ccb5258be584d361a4aa82f1b585c8b35f6d84 /juju/configure-juju-on-openstack
parent4a4a9d3d6aa663288696ce47370f0ec68aa8725f (diff)
make script more robust.
Change-Id: Iacdf67344759401c67a0f69ade91f221d4dd5749 Signed-off-by: Narinder Gupta <narinder.gupta@canonical.com>
Diffstat (limited to 'juju/configure-juju-on-openstack')
-rwxr-xr-xjuju/configure-juju-on-openstack12
1 files changed, 9 insertions, 3 deletions
diff --git a/juju/configure-juju-on-openstack b/juju/configure-juju-on-openstack
index ff60d454..bd2efd61 100755
--- a/juju/configure-juju-on-openstack
+++ b/juju/configure-juju-on-openstack
@@ -27,10 +27,12 @@ set -ex
echo "This command is run to launch the first instance on a new Orange box Openstack deployment"
source ~/nova.rc
+associated=0
#Create a floating IP for the instance
if ( nova list | grep jumpserver2 >/dev/null )
then
+ associated=1
FLOAT_IP="$(nova list | grep jumpserver2 | awk '{ print $13 }')"
else
FLOAT_IP="$(openstack ip floating create ext-net -c ip -f value)"
@@ -49,8 +51,12 @@ do
sleep 1
done
sleep 6
+
#Associate the floating IP with the new instance
-nova floating-ip-associate jumpserver2 $FLOAT_IP || true
+if [ "$associated" -eq "0" ]; then
+ nova floating-ip-associate jumpserver2 $FLOAT_IP || true
+ sleep 90
+fi
sleep 90
@@ -81,7 +87,7 @@ $SSH \
$OS_REGION_NAME:
endpoint: $OS_AUTH_URL
' > os-cloud.yaml"
-$SSH juju add-cloud openstack os-cloud.yaml
+$SSH juju add-cloud openstack os-cloud.yaml --replace
#Output a juju cred file that works on this cloud
$SSH \
@@ -94,7 +100,7 @@ $SSH \
username: $OS_USERNAME
' > os-creds.yaml"
-$SSH "juju add-credential openstack -f os-creds.yaml"
+$SSH "juju add-credential openstack -f os-creds.yaml" --replace
## Creating images metadata
$SSH mkdir -p juju-meta