path: root/tools/
diff options
authorLuis Pabon <>2013-11-26 23:01:51 -0500
committerLuis Pabon <>2013-11-27 04:37:11 -0800
commit3796a1c757f2ea805afead70a58d84ea6ad46374 (patch)
treed681a734f37e169a983dd233b5b00f0fecc08380 /tools/
parentb6a6621ded41fb56c1a2797d9590a79f14d4c1f4 (diff)
Setup and run in a virtual environment
Using tox, developers can down drop into an environment which sets up and runs gluster-swift with gswauth authentication. The developer is then dropped into a shell which is running inside the tox environment. OpenStack Swift and Gluster-Swift are available to the developer. Once the developer exists the shell, the environment will be cleaned up and terminated. Usage: tox -e run Example: $ tox -e run GLOB sdist-make: /home/lpabon/gluster-swift/ run inst-nodeps: /home/lpabon/gluster-swift/.tox/dist/ run runtests: commands[0] | bash tools/ Ring files are prepared in /etc/swift. Please restart object store services Redirecting to /bin/systemctl start memcached.service Starting proxy-server...(/etc/swift/proxy-server.conf) Starting container-server...(/etc/swift/container-server.conf) Starting account-server...(/etc/swift/account-server.conf) Starting object-server...(/etc/swift/object-server.conf) bash-4.2$ swauth-list -K gswauthkey {"accounts": [{"name": "test"}, {"name": "test2"}]} bash-4.2$ swauth-list -K gswauthkey test {"services": {"storage": {"default": "local", "local": ""}}, "account_id": "AUTH_test", "users": [{"name": "tester"}, {"name": "tester3"}]} bash-4.2$ swauth-list -K gswauthkey test tester {"groups": [{"name": "test:tester"}, {"name": "test"}, {"name": ".admin"}], "auth": "plaintext:testing"} bash-4.2$ exit exit Redirecting to /bin/systemctl stop memcached.service Signal proxy-server pid: 22862 signal: 15 Signal container-server pid: 22863 signal: 15 Signal account-server pid: 22864 signal: 15 Signal object-server pid: 22865 signal: 15 proxy-server (22862) appears to have stopped container-server (22863) appears to have stopped account-server (22864) appears to have stopped object-server (22865) appears to have stopped run: commands succeeded congratulations :) Change-Id: I98de5d1b1698b4cd355888f2c15a46df021a9e87 Signed-off-by: Luis Pabon <> Reviewed-on: Reviewed-by: pushpesh sharma <> Tested-by: pushpesh sharma <>
Diffstat (limited to 'tools/')
1 files changed, 92 insertions, 0 deletions
diff --git a/tools/ b/tools/
new file mode 100755
index 0000000..da10630
--- /dev/null
+++ b/tools/
@@ -0,0 +1,92 @@
+# Copyright (c) 2013 Red Hat, Inc.
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+# This program expects to be run by tox in a virtual python environment
+# so that it does not pollute the host development system
+ sudo bash -c "PATH=$PATH $*"
+ sudo service memcached stop
+ sudo_env swift-init main stop
+ sudo rm -rf /etc/swift > /dev/null 2>&1
+ sudo rm -rf /mnt/gluster-object/test{,2}/* > /dev/null 2>&1
+ sudo setfattr -x user.swift.metadata /mnt/gluster-object/test{,2} > /dev/null 2>&1
+ gswauth_cleanup
+ sudo rm -rf /mnt/gluster-object/gsmetadata/.* > /dev/null 2>&1
+ sudo rm -rf /mnt/gluster-object/gsmetadata/* > /dev/null 2>&1
+ sudo setfattr -x user.swift.metadata /mnt/gluster-object/gsmetadata > /dev/null 2>&1
+ echo "$1"
+ exit 1
+ cleanup
+ quit "$1"
+### MAIN ###
+# Only run if there is no configuration in the system
+if [ -x /etc/swift ] ; then
+ quit "/etc/swift exists, cannot run functional tests."
+# Check the directories exist
+DIRS="/mnt/gluster-object /mnt/gluster-object/test /mnt/gluster-object/test2 /mnt/gluster-object/gsmetadata"
+for d in $DIRS ; do
+ if [ ! -x $d ] ; then
+ quit "$d must exist on an XFS or GlusterFS volume"
+ fi
+export SWIFT_TEST_CONFIG_FILE=/etc/swift/test.conf
+# Install the configuration files
+sudo mkdir /etc/swift > /dev/null 2>&1
+sudo cp -r test/functional_auth/gswauth/conf/* /etc/swift || fail "Unable to copy configuration files to /etc/swift"
+sudo_env gluster-swift-gen-builders test test2 gsmetadata || fail "Unable to create ring files"
+# Start the services
+sudo service memcached start || fail "Unable to start memcached"
+sudo_env swift-init main start || fail "Unable to start swift"
+sudo_env swauth-prep -K gswauthkey || fail "Unable to prep gswauth"
+sudo_env swauth-prep -K gswauthkey || fail "Unable to prep gswauth"
+sudo_env swauth-add-user -K gswauthkey -a test tester testing || fail "Unable to add user test"
+sudo_env swauth-add-user -K gswauthkey -a test2 tester2 testing2 || fail "Unable to add user test2"
+sudo_env swauth-add-user -K gswauthkey test tester3 testing3 || fail "Unable to add user test3"
+# open the shell to the user
+bash --norc -i
+exit 0