summaryrefslogtreecommitdiffstats
path: root/tools/sample_data.sh
diff options
context:
space:
mode:
authorAlan Pevec <apevec@redhat.com>2012-02-27 17:59:33 +0100
committerAlan Pevec <apevec@redhat.com>2012-03-13 17:34:43 +0100
commitf8cbd611cfa258f75051e41ebd83501cfec06630 (patch)
tree7d80665ebef5a1820bb55a4770f2f0bbc4900108 /tools/sample_data.sh
parent1e07b98d77a6ccb254e6f4411682235a47dab137 (diff)
downloadkeystone-f8cbd611cfa258f75051e41ebd83501cfec06630.tar.gz
keystone-f8cbd611cfa258f75051e41ebd83501cfec06630.tar.xz
keystone-f8cbd611cfa258f75051e41ebd83501cfec06630.zip
sample_data.sh: check file paths for packaged installations
v4: try to use system-wide configuration first then fallback to assuming git checkout Change-Id: I6916f554cb9848fcb2d090e142b8915ad19a7486
Diffstat (limited to 'tools/sample_data.sh')
-rwxr-xr-xtools/sample_data.sh19
1 files changed, 15 insertions, 4 deletions
diff --git a/tools/sample_data.sh b/tools/sample_data.sh
index 58517224..31b97055 100755
--- a/tools/sample_data.sh
+++ b/tools/sample_data.sh
@@ -50,6 +50,17 @@
# invisible_to_admin demo Member
TOOLS_DIR=$(cd $(dirname "$0") && pwd)
+KEYSTONE_CONF=${KEYSTONE_CONF:-/etc/keystone/keystone.conf}
+if [[ -r "$KEYSTONE_CONF" ]]; then
+ EC2RC="$(dirname "$KEYSTONE_CONF")/ec2rc"
+elif [[ -r "$TOOLS_DIR/../etc/keystone.conf" ]]; then
+ # assume git checkout
+ KEYSTONE_CONF="$TOOLS_DIR/../etc/keystone.conf"
+ EC2RC="$TOOLS_DIR/../etc/ec2rc"
+else
+ KEYSTONE_CONF=""
+ EC2RC="ec2rc"
+fi
# Please set these, they are ONLY SAMPLE PASSWORDS!
ADMIN_PASSWORD=${ADMIN_PASSWORD:-secrete}
@@ -64,9 +75,9 @@ if [[ "$SERVICE_PASSWORD" == "$ADMIN_PASSWORD" ]]; then
fi
# Extract some info from Keystone's configuration file
-if [[ -r $TOOLS_DIR/../etc/keystone.conf ]]; then
- CONFIG_SERVICE_TOKEN=$(sed 's/[[:space:]]//g' $TOOLS_DIR/../etc/keystone.conf | grep ^admin_token= | cut -d'=' -f2)
- CONFIG_ADMIN_PORT=$(sed 's/[[:space:]]//g' $TOOLS_DIR/../etc/keystone.conf | grep ^admin_port= | cut -d'=' -f2)
+if [[ -r "$KEYSTONE_CONF" ]]; then
+ CONFIG_SERVICE_TOKEN=$(sed 's/[[:space:]]//g' $KEYSTONE_CONF | grep ^admin_token= | cut -d'=' -f2)
+ CONFIG_ADMIN_PORT=$(sed 's/[[:space:]]//g' $KEYSTONE_CONF | grep ^admin_port= | cut -d'=' -f2)
fi
export SERVICE_TOKEN=${SERVICE_TOKEN:-$CONFIG_SERVICE_TOKEN}
@@ -232,7 +243,7 @@ DEMO_ACCESS=`echo "$RESULT" | grep access | awk '{print $4}'`
DEMO_SECRET=`echo "$RESULT" | grep secret | awk '{print $4}'`
# write the secret and access to ec2rc
-cat > $TOOLS_DIR/../etc/ec2rc <<EOF
+cat > $EC2RC <<EOF
ADMIN_ACCESS=$ADMIN_ACCESS
ADMIN_SECRET=$ADMIN_SECRET
DEMO_ACCESS=$DEMO_ACCESS