blob: d8b41a330f68eff44f68ae50fb8d2f31d1c1bfd1 [file] [log] [blame]
Todd Willey3e6ec232011-11-04 12:23:35 -04001#!/usr/bin/env bash
2
Dean Troyer27e32692012-03-16 16:16:56 -05003# **swift.sh**
4
Todd Willey3e6ec232011-11-04 12:23:35 -04005# Test swift via the command line tools that ship with it.
6
Dean Troyer27e32692012-03-16 16:16:56 -05007echo "*********************************************************************"
Dean Troyer489bd2a2012-03-02 10:44:29 -06008echo "Begin DevStack Exercise: $0"
Dean Troyer27e32692012-03-16 16:16:56 -05009echo "*********************************************************************"
Dean Troyer489bd2a2012-03-02 10:44:29 -060010
Todd Willey3e6ec232011-11-04 12:23:35 -040011# This script exits on an error so that errors don't compound and you see
12# only the first error that occured.
13set -o errexit
14
15# Print the commands being run so that we can see the command that triggers
16# an error. It is also useful for following allowing as the install occurs.
17set -o xtrace
18
19
20# Settings
21# ========
22
Dean Troyer51fb4542012-03-09 22:21:59 -060023# Keep track of the current directory
24EXERCISE_DIR=$(cd $(dirname "$0") && pwd)
25TOP_DIR=$(cd $EXERCISE_DIR/..; pwd)
Dean Troyer489bd2a2012-03-02 10:44:29 -060026
27# Import common functions
Dean Troyer51fb4542012-03-09 22:21:59 -060028source $TOP_DIR/functions
Dean Troyer489bd2a2012-03-02 10:44:29 -060029
30# Import configuration
Dean Troyer51fb4542012-03-09 22:21:59 -060031source $TOP_DIR/openrc
32
33# Import exercise configuration
34source $TOP_DIR/exerciserc
Dean Troyer489bd2a2012-03-02 10:44:29 -060035
36# Container name
37CONTAINER=ex-swift
Todd Willey3e6ec232011-11-04 12:23:35 -040038
39
40# Testing Swift
41# =============
42
43# Check if we have to swift via keystone
Dean Troyer27e32692012-03-16 16:16:56 -050044swift stat || die "Failure geting status"
Todd Willey3e6ec232011-11-04 12:23:35 -040045
46# We start by creating a test container
Dean Troyer27e32692012-03-16 16:16:56 -050047swift post $CONTAINER || die "Failure creating container $CONTAINER"
Todd Willey3e6ec232011-11-04 12:23:35 -040048
49# add some files into it.
Dean Troyer27e32692012-03-16 16:16:56 -050050swift upload $CONTAINER /etc/issue || die "Failure uploading file to container $CONTAINER"
Todd Willey3e6ec232011-11-04 12:23:35 -040051
52# list them
Dean Troyer27e32692012-03-16 16:16:56 -050053swift list $CONTAINER || die "Failure listing contents of container $CONTAINER"
Todd Willey3e6ec232011-11-04 12:23:35 -040054
55# And we may want to delete them now that we have tested that
56# everything works.
Dean Troyer27e32692012-03-16 16:16:56 -050057swift delete $CONTAINER || die "Failure deleting container $CONTAINER"
Dean Troyer489bd2a2012-03-02 10:44:29 -060058
59set +o xtrace
Dean Troyer27e32692012-03-16 16:16:56 -050060echo "*********************************************************************"
61echo "SUCCESS: End DevStack Exercise: $0"
62echo "*********************************************************************"