added the service relationship.
[joid.git] / juju / configure-juju-on-openstack
index bfcde5b..e3fdaa9 100755 (executable)
@@ -52,7 +52,7 @@ mkdir -p ~/simplestreams/images
 
 #Now, if necessary, source the nova.rc file for your cloud:
 
-. ~/joid_config/admin-openrcpublic
+. ~/joid_config/admin-openrc
 
 #We can now determine the region name for the cloud by running:
 
@@ -70,8 +70,20 @@ T_IMAGE_ID=`openstack image list -f value | grep -i trusty | cut -f 1 -d " "`
 
 #We can now use Juju to generate the metadata:
 
-juju metadata generate-image -d ~/simplestreams -i $X_IMAGE_ID -s xenial -r $OS_REGION_NAME -u $OS_AUTH_URL
-juju metadata generate-image -d ~/simplestreams -i $T_IMAGE_ID -s trusty -r $OS_REGION_NAME -u $OS_AUTH_URL
+#Upload images to glance
+## image name is used by script to generate metadata .. don't screw the series
+NODE_ARCTYPE=`arch`
+
+if  [ "ppc64le" == "$NODE_ARCTYPE" ]; then
+    NODE_ARCHES="ppc64el"
+elif [ "aarch64" == "$NODE_ARCTYPE" ]; then
+    NODE_ARCHES="arm"
+else
+    NODE_ARCHES="amd64"
+fi
+
+juju metadata generate-image -d ~/simplestreams -i $X_IMAGE_ID -s xenial -r $OS_REGION_NAME -u $OS_AUTH_URL -a $NODE_ARCHES
+juju metadata generate-image -d ~/simplestreams -i $T_IMAGE_ID -s trusty -r $OS_REGION_NAME -u $OS_AUTH_URL -a $NODE_ARCHES
 
 #To verify that the correct metadata files have been generated, you may run:
 #You should see .json files containing the details we just added on the images.
@@ -91,9 +103,9 @@ cd -
 swift stat simplestreams
 
 swift post simplestreams --read-acl .r:*
-openstack service create --name product-stream --description "Product Simple Stream" product-streams
-SWIFT_URL=`openstack endpoint list --service swift --interface internal -c URL -f value`
+openstack service show product-streams > /dev/null 2>&1 || openstack service create --name product-streams --description "Product Simple Stream" product-streams
 
+SWIFT_URL=`openstack endpoint list --service swift --interface public -c URL -f value`
 openstack endpoint create --region $OS_REGION_NAME product-streams public $SWIFT_URL/simplestreams/images
 openstack endpoint create --region $OS_REGION_NAME product-streams internal $SWIFT_URL/simplestreams/images
 
@@ -124,7 +136,7 @@ juju add-credential openstack -f os-creds.yaml --replace
 
 #Bootstrap with Juju
 
-juju bootstrap openstack --config image-metadata-url=$SWIFT_URL/simplestreams/images --config use-floating-ip=true --config network=private
+juju bootstrap openstack --debug --config image-metadata-url=$SWIFT_URL/simplestreams/images --config use-floating-ip=true --config network=private
 juju gui --show-credentials --no-browser
 
 #Print the address of Juju-gui for deployments on Openstack