Skip to content

Commit

Permalink
Accept env variables to override default passwords
Browse files Browse the repository at this point in the history
Preserves the default passwords corresponding to the OpenStack Install
and Deploy Manual while allowing environment variables to specify user
provided passwords. As well, a single common password for all the service
users can be specified using the SERVICE_PASSWORD environment variable.

This fix restores compatibility with the version of this script released
in Folsom where the environment variables could override default passwords.
It also preserves compatibility with the fix for bug 1073291 that brought
the script into line with the docs (but unfortunately broke backwards
compatibility).

There is no warning emited if the user does not override the default
passwords as was present in Folsom, but not in Grizzly. This makes the
fix output compatible with Grizzly only. Note that the logic for warnings
pre-Grizzly was unclear. The script is, however, clearly named "sample"
and warnings are present in the comments.

Change-Id: I927fcddf04dcb87e5c9252f0874939b17f3c4809
Fixes: bug #1166182
  • Loading branch information
Robert H. Hyerle authored and dolph committed May 21, 2013
1 parent 2e5cab9 commit 6090bbe
Showing 1 changed file with 16 additions and 5 deletions.
21 changes: 16 additions & 5 deletions tools/sample_data.sh
Expand Up @@ -37,6 +37,17 @@
# service ec2 admin
# service swift admin

# By default, passwords used are those in the OpenStack Install and Deploy Manual.
# One can override these (publicly known, and hence, insecure) passwords by setting the appropriate
# environment variables. A common default password for all the services can be used by
# setting the "SERVICE_PASSWORD" environment variable.

ADMIN_PASSWORD=${ADMIN_PASSWORD:-secrete}
NOVA_PASSWORD=${NOVA_PASSWORD:-${SERVICE_PASSWORD:-nova}}
GLANCE_PASSWORD=${GLANCE_PASSWORD:-${SERVICE_PASSWORD:-glance}}
EC2_PASSWORD=${EC2_PASSWORD:-${SERVICE_PASSWORD:-ec2}}
SWIFT_PASSWORD=${SWIFT_PASSWORD:-${SERVICE_PASSWORD:-swiftpass}}

CONTROLLER_PUBLIC_ADDRESS=${CONTROLLER_PUBLIC_ADDRESS:-localhost}
CONTROLLER_ADMIN_ADDRESS=${CONTROLLER_ADMIN_ADDRESS:-localhost}
CONTROLLER_INTERNAL_ADDRESS=${CONTROLLER_INTERNAL_ADDRESS:-localhost}
Expand Down Expand Up @@ -80,7 +91,7 @@ DEMO_TENANT=$(get_id keystone tenant-create --name=demo \
--description "Default Tenant")

ADMIN_USER=$(get_id keystone user-create --name=admin \
--pass=secrete)
--pass="${ADMIN_PASSWORD}")

ADMIN_ROLE=$(get_id keystone role-create --name=admin)

Expand All @@ -95,30 +106,30 @@ SERVICE_TENANT=$(get_id keystone tenant-create --name=service \
--description "Service Tenant")

GLANCE_USER=$(get_id keystone user-create --name=glance \
--pass=glance)
--pass="${GLANCE_PASSWORD}")

keystone user-role-add --user-id $GLANCE_USER \
--role-id $ADMIN_ROLE \
--tenant-id $SERVICE_TENANT

NOVA_USER=$(get_id keystone user-create --name=nova \
--pass=nova \
--pass="${NOVA_PASSWORD}" \
--tenant-id $SERVICE_TENANT)

keystone user-role-add --user-id $NOVA_USER \
--role-id $ADMIN_ROLE \
--tenant-id $SERVICE_TENANT

EC2_USER=$(get_id keystone user-create --name=ec2 \
--pass=ec2 \
--pass="${EC2_PASSWORD}" \
--tenant-id $SERVICE_TENANT)

keystone user-role-add --user-id $EC2_USER \
--role-id $ADMIN_ROLE \
--tenant-id $SERVICE_TENANT

SWIFT_USER=$(get_id keystone user-create --name=swift \
--pass=swiftpass \
--pass="${SWIFT_PASSWORD}" \
--tenant-id $SERVICE_TENANT)

keystone user-role-add --user-id $SWIFT_USER \
Expand Down

0 comments on commit 6090bbe

Please sign in to comment.