another bug fix. 57/35557/4
authorNarinder Gupta <narinder.gupta@canonical.com>
Tue, 30 May 2017 21:30:49 +0000 (16:30 -0500)
committerNarinder Gupta <narinder.gupta@canonical.com>
Wed, 31 May 2017 04:13:32 +0000 (23:13 -0500)
Change-Id: I4aacad242b1c9cef56cfe0c1999c27fdce3dcc0a
Signed-off-by: Narinder Gupta <narinder.gupta@canonical.com>
ci/openstack.sh
juju/configure-juju-on-openstack
juju/joid-configure-openstack

index 24d068f..4fdf1f9 100755 (executable)
@@ -92,13 +92,36 @@ create_openrc() {
         adminPasswd=$(juju config keystone | grep admin-password -A 5 | grep value | awk '{print $2}' 2> /dev/null)
     fi
 
-    configOpenrc admin $adminPasswd admin http://$keystoneIp:5000/v3 RegionOne > ~/joid_config/admin-openrc
+    v3api=`juju config keystone  preferred-api-version`
+
+    if [[ "$v3api" == "3" ]]; then
+        configOpenrc admin $adminPasswd admin http://$keystoneIp:5000/v3 RegionOne > ~/joid_config/admin-openrc
+        chmod 0600 ~/joid_config/admin-openrc
+        source ~/joid_config/admin-openrc
+        projectid=`openstack project show admin -c id -f value`
+        configOpenrc admin $adminPasswd admin http://$keystoneIp:5000/v3 RegionOne $projectid > ~/joid_config/admin-openrc
+    else
+        configOpenrc2 admin $adminPasswd admin http://$keystoneIp:5000/v2.0 RegionOne > ~/joid_config/admin-openrc
+        chmod 0600 ~/joid_config/admin-openrc
+    fi
+}
 
-    chmod 0600 ~/joid_config/admin-openrc
+configOpenrc2() {
+cat <<-EOF
+export SERVICE_ENDPOINT=$4
+unset SERVICE_TOKEN
+unset SERVICE_ENDPOINT
+export OS_USERNAME=$1
+export OS_PASSWORD=$2
+export OS_TENANT_NAME=$3
+export OS_AUTH_URL=$4
+export OS_REGION_NAME=$5
+EOF
 }
 
 configOpenrc() {
 cat <<-EOF
+# unsetting v3 items in case set
 export OS_AUTH_URL=$4
 export OS_USERNAME=$1
 export OS_PASSWORD=$2
@@ -106,9 +129,12 @@ export OS_USER_DOMAIN_NAME=admin_domain
 export OS_PROJECT_DOMAIN_NAME=admin_domain
 export OS_PROJECT_NAME=$3
 export OS_TENANT_NAME=$3
+export OS_TENANT_ID=$6
 export OS_REGION_NAME=$5
 export OS_IDENTITY_API_VERSION=3
 # Swift needs this:
+export OS_ENDPOINT_TYPE=publicURL
+export OS_INTERFACE=public
 export OS_AUTH_VERSION=3
 EOF
 }
index ad357ce..c83a45a 100755 (executable)
@@ -116,6 +116,8 @@ echo "credentials:
       password: $OS_PASSWORD
       tenant-name: $OS_TENANT_NAME
       username: $OS_USERNAME
+      user-domain-name: $OS_USER_DOMAIN_NAME
+      project-domain-name: $OS_PROJECT_DOMAIN_NAME
 " > os-creds.yaml
 
 juju add-credential openstack -f os-creds.yaml --replace
index 5887ac7..52347b4 100755 (executable)
@@ -57,9 +57,9 @@ echo "Configuring security groups for access to ICMP, SSH and RDP by default"
 PROJECT_ID=`openstack project list -c ID -f value --domain admin_domain`
 
 #Configure the default security group to allow ICMP and SSH
-sicmpecuritygroup=`openstack security group list --project "$PROJECT_ID" -c ID -f value`
-openstack security group rule list $securitygroup | grep "icmp" > /dev/null 2>&1 || openstack security group rule create --remote-group $securitygroup --ingress --protocol icmp --prefix "0.0.0.0/0"$securitygroup
-openstack security group rule list $securitygroup | grep "22/tcp" > /dev/null 2>&1 || openstack security group rule create --remote-group $securitygroup --ingress --protocol tcp --dst-port 22:22 --prefix "0.0.0.0/0" $securitygroup
+SEC_GRP=`openstack security group list --project "$PROJECT_ID" -c ID -f value`
+openstack security group rule list $SEC_GRP | grep "icmp" > /dev/null 2>&1 || openstack security group rule create --remote-group $SEC_GRP --ingress --protocol icmp --prefix "0.0.0.0/0" $SEC_GRP
+openstack security group rule list $SEC_GRP | grep "22/tcp" > /dev/null 2>&1 || openstack security group rule create --remote-group $SEC_GRP --ingress --protocol tcp --dst-port 22:22 --prefix "0.0.0.0/0" $SEC_GRP
 
 echo "Uploading default SSH key"