components/openstack/keystone/patches/sample-data.sh.patch
changeset 5405 66fd59fecd68
parent 3998 5bd484384122
child 5448 56f4540f741d
equal deleted inserted replaced
5404:55e409ba4e72 5405:66fd59fecd68
     1 In-house patch to the sample_data.sh script installed in
     1 Update the upstream sample-data.sh script for Solaris shell tools,
     2 /usr/demo/openstack/keystone in order to support all of the standard
     2 additional OpenStack components, and the deprecation of keystone(1) in
     3 services and to allow customization of the individual service
     3 lieu of openstack(1) in Kilo.
     4 endpoints.  Solaris-specific patch and is not suitable for upstream
       
     5 
     4 
     6 It also includes a change to use the standard Solaris tr(1) rather than
     5 This patch is Solaris-specific and not suitable for upstream
     7 GNU sed.
     6 contribution.
     8 
     7 --- keystone-2015.1.2/tools/sample_data.sh.orig	2016-01-12 14:41:47.118476961 -0500
     9 --- keystone-2014.2.rc1/tools/sample_data.sh.~1~	2014-09-30 00:14:14.000000000 -0700
     8 +++ keystone-2015.1.2/tools/sample_data.sh	2016-01-12 14:49:03.317361531 -0500
    10 +++ keystone-2014.2.rc1/tools/sample_data.sh	2014-10-13 00:53:30.614564163 -0700
       
    11 @@ -2,6 +2,8 @@
     9 @@ -2,6 +2,8 @@
    12  
    10  
    13  # Copyright 2013 OpenStack Foundation
    11  # Copyright 2013 OpenStack Foundation
    14  #
    12  #
    15 +# Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
    13 +# Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved.
    16 +#
    14 +#
    17  # Licensed under the Apache License, Version 2.0 (the "License"); you may
    15  # Licensed under the Apache License, Version 2.0 (the "License"); you may
    18  # not use this file except in compliance with the License. You may obtain
    16  # not use this file except in compliance with the License. You may obtain
    19  # a copy of the License at
    17  # a copy of the License at
    20 @@ -36,22 +38,47 @@
    18 @@ -19,8 +21,8 @@
    21  # service              nova      admin
    19  # This script is based on the original DevStack keystone_data.sh script.
    22  # service              ec2       admin
    20  #
    23  # service              swift     admin
    21  # It demonstrates how to bootstrap Keystone with an administrative user
    24 +# service              cinder    admin
    22 -# using the OS_SERVICE_TOKEN and OS_SERVICE_ENDPOINT environment variables
    25 +# service              neutron   admin
    23 -# and the administrative API.  It will get the admin_token (OS_SERVICE_TOKEN)
       
    24 +# using the OS_TOKEN and OS_URL environment variables
       
    25 +# and the administrative API.  It will get the admin_token (OS_TOKEN)
       
    26  # and admin_port from keystone.conf if available.
       
    27  #
       
    28  # Disable creation of endpoints by setting DISABLE_ENDPOINTS environment variable.
       
    29 @@ -29,29 +31,67 @@
       
    30  # A EC2-compatible credential is created for the admin user and
       
    31  # placed in etc/ec2rc.
       
    32  #
       
    33 -# Tenant               User      Roles
       
    34 -# -------------------------------------------------------
       
    35 -# demo                 admin     admin
       
    36 -# service              glance    admin
       
    37 -# service              nova      admin
       
    38 -# service              ec2       admin
       
    39 -# service              swift     admin
       
    40 +# Tenant               User       Roles
       
    41 +# --------------------------------------------------------
       
    42 +# demo                 admin      admin
       
    43 +# service              glance     admin
       
    44 +# service              nova       admin
       
    45 +# service              ec2        admin
       
    46 +# service              swift      admin
       
    47 +# service              cinder     admin
       
    48 +# service              neutron    admin
       
    49 +# service              heat       admin
       
    50 +# service              ironic     admin
    26  
    51  
    27  # By default, passwords used are those in the OpenStack Install and Deploy Manual.
    52  # By default, passwords used are those in the OpenStack Install and Deploy Manual.
    28  # One can override these (publicly known, and hence, insecure) passwords by setting the appropriate
    53  # One can override these (publicly known, and hence, insecure) passwords by setting the appropriate
    29  # environment variables. A common default password for all the services can be used by
    54  # environment variables. A common default password for all the services can be used by
    30  # setting the "SERVICE_PASSWORD" environment variable.
    55  # setting the "SERVICE_PASSWORD" environment variable.
    37  EC2_PASSWORD=${EC2_PASSWORD:-${SERVICE_PASSWORD:-ec2}}
    62  EC2_PASSWORD=${EC2_PASSWORD:-${SERVICE_PASSWORD:-ec2}}
    38 -SWIFT_PASSWORD=${SWIFT_PASSWORD:-${SERVICE_PASSWORD:-swiftpass}}
    63 -SWIFT_PASSWORD=${SWIFT_PASSWORD:-${SERVICE_PASSWORD:-swiftpass}}
    39 +SWIFT_PASSWORD=${SWIFT_PASSWORD:-${SERVICE_PASSWORD:-swift}}
    64 +SWIFT_PASSWORD=${SWIFT_PASSWORD:-${SERVICE_PASSWORD:-swift}}
    40 +CINDER_PASSWORD=${CINDER_PASSWORD:-${SERVICE_PASSWORD:-cinder}}
    65 +CINDER_PASSWORD=${CINDER_PASSWORD:-${SERVICE_PASSWORD:-cinder}}
    41 +NEUTRON_PASSWORD=${NEUTRON_PASSWORD:-${SERVICE_PASSWORD:-neutron}}
    66 +NEUTRON_PASSWORD=${NEUTRON_PASSWORD:-${SERVICE_PASSWORD:-neutron}}
       
    67 +HEAT_PASSWORD=${HEAT_PASSWORD:-${SERVICE_PASSWORD:-heat}}
       
    68 +IRONIC_PASSWORD=${IRONIC_PASSWORD:-${SERVICE_PASSWORD:-ironic}}
    42  
    69  
    43  CONTROLLER_PUBLIC_ADDRESS=${CONTROLLER_PUBLIC_ADDRESS:-localhost}
    70  CONTROLLER_PUBLIC_ADDRESS=${CONTROLLER_PUBLIC_ADDRESS:-localhost}
    44  CONTROLLER_ADMIN_ADDRESS=${CONTROLLER_ADMIN_ADDRESS:-localhost}
    71  CONTROLLER_ADMIN_ADDRESS=${CONTROLLER_ADMIN_ADDRESS:-localhost}
    45  CONTROLLER_INTERNAL_ADDRESS=${CONTROLLER_INTERNAL_ADDRESS:-localhost}
    72  CONTROLLER_INTERNAL_ADDRESS=${CONTROLLER_INTERNAL_ADDRESS:-localhost}
    46  
    73  
    60 +CINDER_ADMIN_ADDRESS=${CINDER_ADMIN_ADDRESS:-$CONTROLLER_ADMIN_ADDRESS}
    87 +CINDER_ADMIN_ADDRESS=${CINDER_ADMIN_ADDRESS:-$CONTROLLER_ADMIN_ADDRESS}
    61 +CINDER_INTERNAL_ADDRESS=${CINDER_INTERNAL_ADDRESS:-$CONTROLLER_INTERNAL_ADDRESS}
    88 +CINDER_INTERNAL_ADDRESS=${CINDER_INTERNAL_ADDRESS:-$CONTROLLER_INTERNAL_ADDRESS}
    62 +NEUTRON_PUBLIC_ADDRESS=${NEUTRON_PUBLIC_ADDRESS:-$CONTROLLER_PUBLIC_ADDRESS}
    89 +NEUTRON_PUBLIC_ADDRESS=${NEUTRON_PUBLIC_ADDRESS:-$CONTROLLER_PUBLIC_ADDRESS}
    63 +NEUTRON_ADMIN_ADDRESS=${NEUTRON_ADMIN_ADDRESS:-$CONTROLLER_ADMIN_ADDRESS}
    90 +NEUTRON_ADMIN_ADDRESS=${NEUTRON_ADMIN_ADDRESS:-$CONTROLLER_ADMIN_ADDRESS}
    64 +NEUTRON_INTERNAL_ADDRESS=${NEUTRON_INTERNAL_ADDRESS:-$CONTROLLER_INTERNAL_ADDRESS}
    91 +NEUTRON_INTERNAL_ADDRESS=${NEUTRON_INTERNAL_ADDRESS:-$CONTROLLER_INTERNAL_ADDRESS}
       
    92 +IRONIC_PUBLIC_ADDRESS=${IRONIC_PUBLIC_ADDRESS:-$CONTROLLER_PUBLIC_ADDRESS}
       
    93 +IRONIC_ADMIN_ADDRESS=${IRONIC_ADMIN_ADDRESS:-$CONTROLLER_ADMIN_ADDRESS}
       
    94 +IRONIC_INTERNAL_ADDRESS=${IRONIC_INTERNAL_ADDRESS:-$CONTROLLER_INTERNAL_ADDRESS}
       
    95 +HEAT_CFN_PUBLIC_ADDRESS=${HEAT_CFN_PUBLIC_ADDRESS:-$CONTROLLER_PUBLIC_ADDRESS}
       
    96 +HEAT_CFN_ADMIN_ADDRESS=${HEAT_CFN_ADMIN_ADDRESS:-$CONTROLLER_ADMIN_ADDRESS}
       
    97 +HEAT_CFN_INTERNAL_ADDRESS=${HEAT_CFN_INTERNAL_ADDRESS:-$CONTROLLER_INTERNAL_ADDRESS}
       
    98 +HEAT_PUBLIC_ADDRESS=${HEAT_PUBLIC_ADDRESS:-$CONTROLLER_PUBLIC_ADDRESS}
       
    99 +HEAT_ADMIN_ADDRESS=${HEAT_ADMIN_ADDRESS:-$CONTROLLER_ADMIN_ADDRESS}
       
   100 +HEAT_INTERNAL_ADDRESS=${HEAT_INTERNAL_ADDRESS:-$CONTROLLER_INTERNAL_ADDRESS}
    65 +
   101 +
    66  TOOLS_DIR=$(cd $(dirname "$0") && pwd)
   102  TOOLS_DIR=$(cd $(dirname "$0") && pwd)
    67  KEYSTONE_CONF=${KEYSTONE_CONF:-/etc/keystone/keystone.conf}
   103  KEYSTONE_CONF=${KEYSTONE_CONF:-/etc/keystone/keystone.conf}
    68  if [[ -r "$KEYSTONE_CONF" ]]; then
   104  if [[ -r "$KEYSTONE_CONF" ]]; then
    69 @@ -67,8 +94,8 @@ fi
   105 @@ -67,169 +107,221 @@
    70  
   106  
    71  # Extract some info from Keystone's configuration file
   107  # Extract some info from Keystone's configuration file
    72  if [[ -r "$KEYSTONE_CONF" ]]; then
   108  if [[ -r "$KEYSTONE_CONF" ]]; then
    73 -    CONFIG_SERVICE_TOKEN=$(sed 's/[[:space:]]//g' $KEYSTONE_CONF | grep ^admin_token= | cut -d'=' -f2)
   109 -    CONFIG_SERVICE_TOKEN=$(sed 's/[[:space:]]//g' $KEYSTONE_CONF | grep ^admin_token= | cut -d'=' -f2)
       
   110 -    if [[ -z "${CONFIG_SERVICE_TOKEN}" ]]; then
       
   111 -        # default config options are commented out, so lets try those
       
   112 -        CONFIG_SERVICE_TOKEN=$(sed 's/[[:space:]]//g' $KEYSTONE_CONF | grep ^\#admin_token= | cut -d'=' -f2)
       
   113 -    fi
    74 -    CONFIG_ADMIN_PORT=$(sed 's/[[:space:]]//g' $KEYSTONE_CONF | grep ^admin_port= | cut -d'=' -f2)
   114 -    CONFIG_ADMIN_PORT=$(sed 's/[[:space:]]//g' $KEYSTONE_CONF | grep ^admin_port= | cut -d'=' -f2)
       
   115 -    if [[ -z "${CONFIG_ADMIN_PORT}" ]]; then
       
   116 -        # default config options are commented out, so lets try those
       
   117 -        CONFIG_ADMIN_PORT=$(sed 's/[[:space:]]//g' $KEYSTONE_CONF | grep ^\#admin_port= | cut -d'=' -f2)
       
   118 -    fi
       
   119 -fi
       
   120 -
       
   121 -export OS_SERVICE_TOKEN=${OS_SERVICE_TOKEN:-$CONFIG_SERVICE_TOKEN}
       
   122 -if [[ -z "$OS_SERVICE_TOKEN" ]]; then
       
   123 -    echo "No service token found."
       
   124 -    echo "Set OS_SERVICE_TOKEN manually from keystone.conf admin_token."
       
   125 -    exit 1
    75 +    CONFIG_SERVICE_TOKEN=$(tr -d '[\t ]' < $KEYSTONE_CONF | grep ^admin_token= | cut -d'=' -f2)
   126 +    CONFIG_SERVICE_TOKEN=$(tr -d '[\t ]' < $KEYSTONE_CONF | grep ^admin_token= | cut -d'=' -f2)
    76 +    CONFIG_ADMIN_PORT=$(tr -d '[\t ]' < $KEYSTONE_CONF | grep ^admin_port= | cut -d'=' -f2)
   127 +    CONFIG_ADMIN_PORT=$(tr -d '[\t ]' < $KEYSTONE_CONF | grep ^admin_port= | cut -d'=' -f2)
    77  fi
   128  fi
    78  
   129  
    79  export OS_SERVICE_TOKEN=${OS_SERVICE_TOKEN:-$CONFIG_SERVICE_TOKEN}
   130 -export OS_SERVICE_ENDPOINT=${OS_SERVICE_ENDPOINT:-http://$CONTROLLER_PUBLIC_ADDRESS:${CONFIG_ADMIN_PORT:-35357}/v2.0}
    80 @@ -136,6 +163,22 @@ keystone user-role-add --user-id $SWIFT_
   131 +export OS_TOKEN=${OS_TOKEN:-$CONFIG_SERVICE_TOKEN}
    81                         --role-id $ADMIN_ROLE \
   132 +if [[ -z "$OS_TOKEN" ]]; then
    82                         --tenant-id $SERVICE_TENANT
   133 +    echo "No authentication token found."
    83  
   134 +    echo "Set OS_TOKEN manually from keystone.conf admin_token."
    84 +CINDER_USER=$(get_id keystone user-create --name=cinder \
   135 +    exit 1
    85 +                                          --pass="${CINDER_PASSWORD}" \
   136 +fi
    86 +                                          --tenant-id $SERVICE_TENANT)
   137  
    87 +
   138 -function get_id () {
    88 +keystone user-role-add --user-id $CINDER_USER \
   139 -    echo `"$@" | grep ' id ' | awk '{print $4}'`
    89 +                       --role-id $ADMIN_ROLE \
   140 -}
    90 +                       --tenant-id $SERVICE_TENANT
   141 +export OS_URL=${OS_URL:-http://$CONTROLLER_PUBLIC_ADDRESS:${CONFIG_ADMIN_PORT:-35357}/v2.0}
    91 +
   142  
    92 +NEUTRON_USER=$(get_id keystone user-create --name=neutron \
   143  #
    93 +                                           --pass="${NEUTRON_PASSWORD}" \
   144  # Default tenant
    94 +                                           --tenant-id $SERVICE_TENANT)
   145  #
    95 +
   146 -DEMO_TENANT=$(get_id keystone tenant-create --name=demo \
    96 +keystone user-role-add --user-id $NEUTRON_USER \
   147 -                                            --description "Default Tenant")
    97 +                       --role-id $ADMIN_ROLE \
   148 -
    98 +                       --tenant-id $SERVICE_TENANT
   149 -ADMIN_USER=$(get_id keystone user-create --name=admin \
    99 +
   150 -                                         --pass="${ADMIN_PASSWORD}")
       
   151 +openstack project create --description "Default Tenant" demo
       
   152  
       
   153 -ADMIN_ROLE=$(get_id keystone role-create --name=admin)
       
   154 -
       
   155 -keystone user-role-add --user-id $ADMIN_USER \
       
   156 -                       --role-id $ADMIN_ROLE \
       
   157 -                       --tenant-id $DEMO_TENANT
       
   158 +# Admin user/role
       
   159 +openstack user create --project demo --password "${ADMIN_PASSWORD}" admin
       
   160 +openstack role create admin
       
   161 +openstack role add --user admin --project demo admin
       
   162  
       
   163  #
       
   164  # Service tenant
       
   165  #
       
   166 -SERVICE_TENANT=$(get_id keystone tenant-create --name=service \
       
   167 -                                               --description "Service Tenant")
       
   168 -
       
   169 -GLANCE_USER=$(get_id keystone user-create --name=glance \
       
   170 -                                          --pass="${GLANCE_PASSWORD}")
       
   171 +openstack project create --description "Service Tenant" service
       
   172  
       
   173 -keystone user-role-add --user-id $GLANCE_USER \
       
   174 -                       --role-id $ADMIN_ROLE \
       
   175 -                       --tenant-id $SERVICE_TENANT
       
   176 -
       
   177 -NOVA_USER=$(get_id keystone user-create --name=nova \
       
   178 -                                        --pass="${NOVA_PASSWORD}" \
       
   179 -                                        --tenant-id $SERVICE_TENANT)
       
   180 -
       
   181 -keystone user-role-add --user-id $NOVA_USER \
       
   182 -                       --role-id $ADMIN_ROLE \
       
   183 -                       --tenant-id $SERVICE_TENANT
       
   184 -
       
   185 -EC2_USER=$(get_id keystone user-create --name=ec2 \
       
   186 -                                       --pass="${EC2_PASSWORD}" \
       
   187 -                                       --tenant-id $SERVICE_TENANT)
       
   188 -
       
   189 -keystone user-role-add --user-id $EC2_USER \
       
   190 -                       --role-id $ADMIN_ROLE \
       
   191 -                       --tenant-id $SERVICE_TENANT
       
   192 -
       
   193 -SWIFT_USER=$(get_id keystone user-create --name=swift \
       
   194 -                                         --pass="${SWIFT_PASSWORD}" \
       
   195 -                                         --tenant-id $SERVICE_TENANT)
       
   196 -
       
   197 -keystone user-role-add --user-id $SWIFT_USER \
       
   198 -                       --role-id $ADMIN_ROLE \
       
   199 -                       --tenant-id $SERVICE_TENANT
       
   200 +# Glance user
       
   201 +openstack user create --project service --password "${GLANCE_PASSWORD}" glance
       
   202 +openstack role add --user glance --project service admin
       
   203 +
       
   204 +# Nova user
       
   205 +openstack user create --project service --password "${NOVA_PASSWORD}" nova
       
   206 +openstack role add --user nova --project service admin
       
   207 +
       
   208 +# EC2 user
       
   209 +openstack user create --project service --password "${EC2_PASSWORD}" ec2
       
   210 +openstack role add --user ec2 --project service admin
       
   211 +
       
   212 +# Swift user
       
   213 +openstack user create --project service --password "${SWIFT_PASSWORD}" swift
       
   214 +openstack role add --user swift --project service admin
       
   215 +
       
   216 +# Cinder user
       
   217 +openstack user create --project service --password "${CINDER_PASSWORD}"  cinder
       
   218 +openstack role add --user cinder --project service admin
       
   219 +
       
   220 +# Neutron user
       
   221 +openstack user create --project service --password "${NEUTRON_PASSWORD}" neutron
       
   222 +openstack role add --user neutron --project service admin
       
   223 +
       
   224 +# Ironic user
       
   225 +openstack user create --project service --password "${IRONIC_PASSWORD}" ironic
       
   226 +openstack role add --user ironic --project service admin
       
   227 +
       
   228 +# Heat user
       
   229 +openstack user create --project service --password "${HEAT_PASSWORD}" heat
       
   230 +openstack role add --user heat --project service admin
       
   231  
   100  #
   232  #
   101  # Keystone service
   233  # Keystone service
   102  #
   234  #
   103 @@ -159,23 +202,23 @@ keystone service-create --name=nova \
   235 -KEYSTONE_SERVICE=$(get_id \
   104                          --description="Nova Compute Service")
   236 -keystone service-create --name=keystone \
       
   237 -                        --type=identity \
       
   238 -                        --description="Keystone Identity Service")
       
   239 +openstack service create --name keystone \
       
   240 +                         --description "Keystone Identity Service" \
       
   241 +                        identity
   105  if [[ -z "$DISABLE_ENDPOINTS" ]]; then
   242  if [[ -z "$DISABLE_ENDPOINTS" ]]; then
   106      keystone endpoint-create --region RegionOne --service-id $NOVA_SERVICE \
   243 -    keystone endpoint-create --region RegionOne --service-id $KEYSTONE_SERVICE \
       
   244 +    openstack endpoint create --region RegionOne \
       
   245          --publicurl "http://$CONTROLLER_PUBLIC_ADDRESS:\$(public_port)s/v2.0" \
       
   246          --adminurl "http://$CONTROLLER_ADMIN_ADDRESS:\$(admin_port)s/v2.0" \
       
   247 -        --internalurl "http://$CONTROLLER_INTERNAL_ADDRESS:\$(public_port)s/v2.0"
       
   248 +        --internalurl "http://$CONTROLLER_INTERNAL_ADDRESS:\$(public_port)s/v2.0" \
       
   249 +       keystone
       
   250  fi
       
   251  
       
   252 +
       
   253  #
       
   254  # Nova service
       
   255  #
       
   256 -NOVA_SERVICE=$(get_id \
       
   257 -keystone service-create --name=nova \
       
   258 -                        --type=compute \
       
   259 -                        --description="Nova Compute Service")
       
   260 +openstack service create --name nova \
       
   261 +                         --description="Nova Compute Service" \
       
   262 +                         compute
       
   263  if [[ -z "$DISABLE_ENDPOINTS" ]]; then
       
   264 -    keystone endpoint-create --region RegionOne --service-id $NOVA_SERVICE \
   107 -        --publicurl "http://$CONTROLLER_PUBLIC_ADDRESS:8774/v2/\$(tenant_id)s" \
   265 -        --publicurl "http://$CONTROLLER_PUBLIC_ADDRESS:8774/v2/\$(tenant_id)s" \
   108 -        --adminurl "http://$CONTROLLER_ADMIN_ADDRESS:8774/v2/\$(tenant_id)s" \
   266 -        --adminurl "http://$CONTROLLER_ADMIN_ADDRESS:8774/v2/\$(tenant_id)s" \
   109 -        --internalurl "http://$CONTROLLER_INTERNAL_ADDRESS:8774/v2/\$(tenant_id)s"
   267 -        --internalurl "http://$CONTROLLER_INTERNAL_ADDRESS:8774/v2/\$(tenant_id)s"
       
   268 +    openstack endpoint create --region RegionOne \
   110 +        --publicurl "http://$NOVA_PUBLIC_ADDRESS:8774/v2/\$(tenant_id)s" \
   269 +        --publicurl "http://$NOVA_PUBLIC_ADDRESS:8774/v2/\$(tenant_id)s" \
   111 +        --adminurl "http://$NOVA_ADMIN_ADDRESS:8774/v2/\$(tenant_id)s" \
   270 +        --adminurl "http://$NOVA_ADMIN_ADDRESS:8774/v2/\$(tenant_id)s" \
   112 +        --internalurl "http://$NOVA_INTERNAL_ADDRESS:8774/v2/\$(tenant_id)s"
   271 +        --internalurl "http://$NOVA_INTERNAL_ADDRESS:8774/v2/\$(tenant_id)s" \
   113  fi
   272 +       nova
   114  
   273  fi
   115  #
   274  
   116  # Volume service
   275 +
   117  #
   276  #
   118  VOLUME_SERVICE=$(get_id \
   277 -# Volume service
       
   278 +# Volume service - v1 and v2
       
   279  #
       
   280 -VOLUME_SERVICE=$(get_id \
   119 -keystone service-create --name=volume \
   281 -keystone service-create --name=volume \
   120 +keystone service-create --name=cinder \
   282 -                        --type=volume \
   121                          --type=volume \
       
   122 -                        --description="Nova Volume Service")
   283 -                        --description="Nova Volume Service")
   123 +                        --description="Cinder Volume Service")
   284 +openstack service create --name cinder \
       
   285 +                         --description "Cinder Volume Service" \
       
   286 +                        volume
       
   287 +openstack service create --name cinderv2 \
       
   288 +                         --description "Cinder Volume Service version 2" \
       
   289 +                        volumev2
   124  if [[ -z "$DISABLE_ENDPOINTS" ]]; then
   290  if [[ -z "$DISABLE_ENDPOINTS" ]]; then
   125      keystone endpoint-create --region RegionOne --service-id $VOLUME_SERVICE \
   291 -    keystone endpoint-create --region RegionOne --service-id $VOLUME_SERVICE \
   126 -        --publicurl "http://$CONTROLLER_PUBLIC_ADDRESS:8776/v1/\$(tenant_id)s" \
   292 -        --publicurl "http://$CONTROLLER_PUBLIC_ADDRESS:8776/v1/\$(tenant_id)s" \
   127 -        --adminurl "http://$CONTROLLER_ADMIN_ADDRESS:8776/v1/\$(tenant_id)s" \
   293 -        --adminurl "http://$CONTROLLER_ADMIN_ADDRESS:8776/v1/\$(tenant_id)s" \
   128 -        --internalurl "http://$CONTROLLER_INTERNAL_ADDRESS:8776/v1/\$(tenant_id)s"
   294 -        --internalurl "http://$CONTROLLER_INTERNAL_ADDRESS:8776/v1/\$(tenant_id)s"
       
   295 +    openstack endpoint create --region RegionOne \
   129 +        --publicurl "http://$CINDER_PUBLIC_ADDRESS:8776/v1/\$(tenant_id)s" \
   296 +        --publicurl "http://$CINDER_PUBLIC_ADDRESS:8776/v1/\$(tenant_id)s" \
   130 +        --adminurl "http://$CINDER_ADMIN_ADDRESS:8776/v1/\$(tenant_id)s" \
   297 +        --adminurl "http://$CINDER_ADMIN_ADDRESS:8776/v1/\$(tenant_id)s" \
   131 +        --internalurl "http://$CINDER_INTERNAL_ADDRESS:8776/v1/\$(tenant_id)s"
   298 +        --internalurl "http://$CINDER_INTERNAL_ADDRESS:8776/v1/\$(tenant_id)s" \
   132  fi
   299 +       cinder
   133  
   300  fi
   134  #
   301 +if [[ -z "$DISABLE_ENDPOINTS" ]]; then
   135 @@ -187,9 +230,9 @@ keystone service-create --name=glance \
   302 +    openstack endpoint create --region RegionOne \
   136                          --description="Glance Image Service")
   303 +        --publicurl "http://$CINDER_PUBLIC_ADDRESS:8776/v2/\$(tenant_id)s" \
   137  if [[ -z "$DISABLE_ENDPOINTS" ]]; then
   304 +        --adminurl "http://$CINDER_ADMIN_ADDRESS:8776/v2/\$(tenant_id)s" \
   138      keystone endpoint-create --region RegionOne --service-id $GLANCE_SERVICE \
   305 +        --internalurl "http://$CINDER_INTERNAL_ADDRESS:8776/v2/\$(tenant_id)s" \
       
   306 +       cinderv2
       
   307 +fi
       
   308 +
       
   309  
       
   310  #
       
   311  # Image service
       
   312  #
       
   313 -GLANCE_SERVICE=$(get_id \
       
   314 -keystone service-create --name=glance \
       
   315 -                        --type=image \
       
   316 -                        --description="Glance Image Service")
       
   317 -if [[ -z "$DISABLE_ENDPOINTS" ]]; then
       
   318 -    keystone endpoint-create --region RegionOne --service-id $GLANCE_SERVICE \
   139 -        --publicurl "http://$CONTROLLER_PUBLIC_ADDRESS:9292" \
   319 -        --publicurl "http://$CONTROLLER_PUBLIC_ADDRESS:9292" \
   140 -        --adminurl "http://$CONTROLLER_ADMIN_ADDRESS:9292" \
   320 -        --adminurl "http://$CONTROLLER_ADMIN_ADDRESS:9292" \
   141 -        --internalurl "http://$CONTROLLER_INTERNAL_ADDRESS:9292"
   321 -        --internalurl "http://$CONTROLLER_INTERNAL_ADDRESS:9292"
       
   322 +openstack service create --name glance \
       
   323 +                         --description "Glance Image Service" \
       
   324 +                        image
       
   325 +if [[ -z "$DISABLE_ENDPOINTS" ]]; then
       
   326 +    openstack endpoint create --region RegionOne \
   142 +        --publicurl "http://$GLANCE_PUBLIC_ADDRESS:9292" \
   327 +        --publicurl "http://$GLANCE_PUBLIC_ADDRESS:9292" \
   143 +        --adminurl "http://$GLANCE_ADMIN_ADDRESS:9292" \
   328 +        --adminurl "http://$GLANCE_ADMIN_ADDRESS:9292" \
   144 +        --internalurl "http://$GLANCE_INTERNAL_ADDRESS:9292"
   329 +        --internalurl "http://$GLANCE_INTERNAL_ADDRESS:9292" \
   145  fi
   330 +       glance
   146  
   331  fi
   147  #
   332  
   148 @@ -201,9 +244,9 @@ keystone service-create --name=ec2 \
   333 +
   149                          --description="EC2 Compatibility Layer")
   334  #
   150  if [[ -z "$DISABLE_ENDPOINTS" ]]; then
   335  # EC2 service
   151      keystone endpoint-create --region RegionOne --service-id $EC2_SERVICE \
   336  #
       
   337 -EC2_SERVICE=$(get_id \
       
   338 -keystone service-create --name=ec2 \
       
   339 -                        --type=ec2 \
       
   340 -                        --description="EC2 Compatibility Layer")
       
   341 -if [[ -z "$DISABLE_ENDPOINTS" ]]; then
       
   342 -    keystone endpoint-create --region RegionOne --service-id $EC2_SERVICE \
   152 -        --publicurl "http://$CONTROLLER_PUBLIC_ADDRESS:8773/services/Cloud" \
   343 -        --publicurl "http://$CONTROLLER_PUBLIC_ADDRESS:8773/services/Cloud" \
   153 -        --adminurl "http://$CONTROLLER_ADMIN_ADDRESS:8773/services/Admin" \
   344 -        --adminurl "http://$CONTROLLER_ADMIN_ADDRESS:8773/services/Admin" \
   154 -        --internalurl "http://$CONTROLLER_INTERNAL_ADDRESS:8773/services/Cloud"
   345 -        --internalurl "http://$CONTROLLER_INTERNAL_ADDRESS:8773/services/Cloud"
       
   346 +openstack service create --name ec2 \
       
   347 +                         --description "EC2 Compatibility Layer" \
       
   348 +                        ec2
       
   349 +if [[ -z "$DISABLE_ENDPOINTS" ]]; then
       
   350 +    openstack endpoint create --region RegionOne \
   155 +        --publicurl "http://$EC2_PUBLIC_ADDRESS:8773/services/Cloud" \
   351 +        --publicurl "http://$EC2_PUBLIC_ADDRESS:8773/services/Cloud" \
   156 +        --adminurl "http://$EC2_ADMIN_ADDRESS:8773/services/Admin" \
   352 +        --adminurl "http://$EC2_ADMIN_ADDRESS:8773/services/Admin" \
   157 +        --internalurl "http://$EC2_INTERNAL_ADDRESS:8773/services/Cloud"
   353 +        --internalurl "http://$EC2_INTERNAL_ADDRESS:8773/services/Cloud" \
   158  fi
   354 +       ec2
   159  
   355  fi
   160  #
   356  
   161 @@ -212,15 +255,34 @@ fi
   357 +
   162  SWIFT_SERVICE=$(get_id \
   358  #
   163  keystone service-create --name=swift \
   359  # Swift service
   164                          --type="object-store" \
   360  #
       
   361 -SWIFT_SERVICE=$(get_id \
       
   362 -keystone service-create --name=swift \
       
   363 -                        --type="object-store" \
   165 -                        --description="Swift Service")
   364 -                        --description="Swift Service")
   166 +                        --description="Swift Object Store Service")
   365 -if [[ -z "$DISABLE_ENDPOINTS" ]]; then
   167  if [[ -z "$DISABLE_ENDPOINTS" ]]; then
   366 -    keystone endpoint-create --region RegionOne --service-id $SWIFT_SERVICE \
   168      keystone endpoint-create --region RegionOne --service-id $SWIFT_SERVICE \
       
   169 -        --publicurl   "http://$CONTROLLER_PUBLIC_ADDRESS:8080/v1/AUTH_\$(tenant_id)s" \
   367 -        --publicurl   "http://$CONTROLLER_PUBLIC_ADDRESS:8080/v1/AUTH_\$(tenant_id)s" \
   170 -        --adminurl    "http://$CONTROLLER_ADMIN_ADDRESS:8080/v1" \
   368 -        --adminurl    "http://$CONTROLLER_ADMIN_ADDRESS:8080/v1" \
   171 -        --internalurl "http://$CONTROLLER_INTERNAL_ADDRESS:8080/v1/AUTH_\$(tenant_id)s"
   369 -        --internalurl "http://$CONTROLLER_INTERNAL_ADDRESS:8080/v1/AUTH_\$(tenant_id)s"
       
   370 +openstack service create --name swift \
       
   371 +                         --description "Swift Object Store Service" \
       
   372 +                        object-store
       
   373 +if [[ -z "$DISABLE_ENDPOINTS" ]]; then
       
   374 +    openstack endpoint create --region RegionOne \
   172 +        --publicurl "http://$SWIFT_PUBLIC_ADDRESS:8080/v1/AUTH_\$(tenant_id)s" \
   375 +        --publicurl "http://$SWIFT_PUBLIC_ADDRESS:8080/v1/AUTH_\$(tenant_id)s" \
   173 +        --adminurl "http://$SWIFT_ADMIN_ADDRESS:8080/v1" \
   376 +        --adminurl "http://$SWIFT_ADMIN_ADDRESS:8080/v1" \
   174 +        --internalurl "http://$SWIFT_INTERNAL_ADDRESS:8080/v1/AUTH_\$(tenant_id)s"
   377 +        --internalurl "http://$SWIFT_INTERNAL_ADDRESS:8080/v1/AUTH_\$(tenant_id)s" \
       
   378 +       swift
   175 +fi
   379 +fi
   176 +
   380 +
       
   381 +
   177 +#
   382 +#
   178 +# Neutron service
   383 +# Neutron service
   179 +#
   384 +#
   180 +NEUTRON_SERVICE=$(get_id \
   385 +openstack service create --name neutron \
   181 +keystone service-create --name=neutron \
   386 +                         --description "Neutron Network Service" \
   182 +                        --type=network \
   387 +                        network
   183 +                        --description="Neutron Network Service")
   388 +if [[ -z "$DISABLE_ENDPOINTS" ]]; then
   184 +if [[ -z "$DISABLE_ENDPOINTS" ]]; then
   389 +    openstack endpoint create --region RegionOne \
   185 +    keystone endpoint-create --region RegionOne --service-id $NEUTRON_SERVICE \
       
   186 +        --publicurl "http://$NEUTRON_PUBLIC_ADDRESS:9696/" \
   390 +        --publicurl "http://$NEUTRON_PUBLIC_ADDRESS:9696/" \
   187 +        --adminurl "http://$NEUTRON_ADMIN_ADDRESS:9696/" \
   391 +        --adminurl "http://$NEUTRON_ADMIN_ADDRESS:9696/" \
   188 +        --internalurl "http://$NEUTRON_INTERNAL_ADDRESS:9696/"
   392 +        --internalurl "http://$NEUTRON_INTERNAL_ADDRESS:9696/" \
       
   393 +       neutron
       
   394 +fi
       
   395 +
       
   396 +#
       
   397 +# Ironic service
       
   398 +#
       
   399 +openstack service create --name ironic \
       
   400 +                        --description "Bare Metal Provisioning Service" \
       
   401 +                        baremetal
       
   402 +if [[ -z "$DISABLE_ENDPOINTS" ]]; then
       
   403 +    openstack endpoint create --region RegionOne \
       
   404 +        --publicurl "http://$IRONIC_PUBLIC_ADDRESS:6385/" \
       
   405 +        --adminurl "http://$IRONIC_ADMIN_ADDRESS:6385/" \
       
   406 +        --internalurl "http://$IRONIC_INTERNAL_ADDRESS:6385/" \
       
   407 +       ironic
       
   408 +fi
       
   409 +
       
   410 +#
       
   411 +# Heat services
       
   412 +#
       
   413 +openstack service create --name heat-cfn \
       
   414 +                        --description "Heat CloudFormation API" \
       
   415 +                        cloudformation
       
   416 +
       
   417 +openstack service create --name heat \
       
   418 +                        --description "Heat API" \
       
   419 +                        orchestration
       
   420 +
       
   421 +if [[ -z "$DISABLE_ENDPOINTS" ]]; then
       
   422 +    openstack endpoint create --region RegionOne \
       
   423 +        --publicurl "http://$HEAT_CFN_PUBLIC_ADDRESS:8000/v1" \
       
   424 +        --adminurl "http://$HEAT_CFN_ADMIN_ADDRESS:8000/v1" \
       
   425 +        --internalurl "http://$HEAT_CFN_INTERNAL_ADDRESS:8000/v1" \
       
   426 +       heat-cfn
       
   427 +
       
   428 +    openstack endpoint create --region RegionOne \
       
   429 +        --publicurl "http://$HEAT_PUBLIC_ADDRESS:8004/v1/\$(tenant_id)s" \
       
   430 +        --adminurl "http://$HEAT_ADMIN_ADDRESS:8004/v1/\$(tenant_id)s" \
       
   431 +        --internalurl "http://$HEAT_INTERNAL_ADDRESS:8004/v1/\$(tenant_id)s" \
       
   432 +       heat
   189  fi
   433  fi
   190  
   434  
   191  # create ec2 creds and parse the secret and access key returned
   435  # create ec2 creds and parse the secret and access key returned
   192 +unset SERVICE_ENDPOINT SERVICE_TOKEN
   436 -RESULT=$(keystone ec2-credentials-create --tenant-id=$SERVICE_TENANT --user-id=$ADMIN_USER)
   193 +export OS_AUTH_URL=http://localhost:5000/v2.0
   437 +RESULT=$(openstack ec2 credentials create --project service --user admin)
   194 +export OS_PASSWORD="${ADMIN_PASSWORD}"
       
   195 +export OS_TENANT_NAME=demo
       
   196 +export OS_USERNAME=admin
       
   197  RESULT=$(keystone ec2-credentials-create --tenant-id=$SERVICE_TENANT --user-id=$ADMIN_USER)
       
   198  ADMIN_ACCESS=`echo "$RESULT" | grep access | awk '{print $4}'`
   438  ADMIN_ACCESS=`echo "$RESULT" | grep access | awk '{print $4}'`
   199  ADMIN_SECRET=`echo "$RESULT" | grep secret | awk '{print $4}'`
   439  ADMIN_SECRET=`echo "$RESULT" | grep secret | awk '{print $4}'`
       
   440