3e6ec236 |
#!/usr/bin/env bash
|
27e32699 |
# **swift.sh**
|
da85cdad |
# Test swift via the ``swift`` command line from ``python-swiftclient` |
3e6ec236 |
|
27e32699 |
echo "*********************************************************************" |
489bd2a6 |
echo "Begin DevStack Exercise: $0" |
27e32699 |
echo "*********************************************************************" |
489bd2a6 |
|
3e6ec236 |
# This script exits on an error so that errors don't compound and you see
# only the first error that occured.
set -o errexit
# Print the commands being run so that we can see the command that triggers
# an error. It is also useful for following allowing as the install occurs.
set -o xtrace
# Settings
# ========
|
51fb454f |
# Keep track of the current directory
EXERCISE_DIR=$(cd $(dirname "$0") && pwd)
TOP_DIR=$(cd $EXERCISE_DIR/..; pwd) |
489bd2a6 |
# Import common functions |
51fb454f |
source $TOP_DIR/functions |
489bd2a6 |
# Import configuration |
51fb454f |
source $TOP_DIR/openrc
# Import exercise configuration
source $TOP_DIR/exerciserc |
489bd2a6 |
|
408b009c |
# If swift is not enabled we exit with exitcode 55 which mean
# exercise is skipped. |
0c3a5584 |
is_service_enabled s-proxy || exit 55 |
3e6ec236 |
|
da85cdad |
# Container name
CONTAINER=ex-swift
|
ad101767 |
|
3e6ec236 |
# Testing Swift
# =============
# Check if we have to swift via keystone |
07115eb5 |
swift stat || die $LINENO "Failure geting status" |
3e6ec236 |
# We start by creating a test container |
07115eb5 |
swift post $CONTAINER || die $LINENO "Failure creating container $CONTAINER" |
3e6ec236 |
# add some files into it. |
07115eb5 |
swift upload $CONTAINER /etc/issue || die $LINENO "Failure uploading file to container $CONTAINER" |
3e6ec236 |
# list them |
07115eb5 |
swift list $CONTAINER || die $LINENO "Failure listing contents of container $CONTAINER" |
3e6ec236 |
# And we may want to delete them now that we have tested that
# everything works. |
07115eb5 |
swift delete $CONTAINER || die $LINENO "Failure deleting container $CONTAINER" |
489bd2a6 |
set +o xtrace |
27e32699 |
echo "*********************************************************************"
echo "SUCCESS: End DevStack Exercise: $0"
echo "*********************************************************************" |