the great hard tab purge

get us over to 4 spaces everywhere

Change-Id: I483e96210d154945fb54d9783c47a23fa0b3d962
This commit is contained in:
Sean Dague 2013-03-28 19:07:54 -04:00
parent 1cece477de
commit 1cc91f549d
3 changed files with 135 additions and 131 deletions

View File

@ -9,9 +9,9 @@
# ``grenade.sh [-b] [-t] [-s stop-label] [-q]``
#
# ``-b`` Run only the base part
# ``-t`` Run only the target part (assumes a base run is in place)
# ``-q`` Quiet mode
# ``-b`` Run only the base part
# ``-t`` Run only the target part (assumes a base run is in place)
# ``-q`` Quiet mode
# ``-s stop-label`` is the name of the step after which the script will stop.
# This is useful for debugging upgrades.
@ -37,16 +37,20 @@ RUN_TARGET=$(trueorfalse True $RUN_TARGET)
VERBOSE=$(trueorfalse True $VERBOSE)
while getopts bqs:t c; do
case $c in
b) RUN_TARGET=False
;;
q) VERBOSE=False
;;
s) STOP=$2
;;
t) RUN_BASE=False
;;
esac
case $c in
b)
RUN_TARGET=False
;;
q)
VERBOSE=False
;;
s)
STOP=$2
;;
t)
RUN_BASE=False
;;
esac
done
shift `expr $OPTIND - 1`
@ -160,60 +164,60 @@ TARGET_RUN_EXERCISES=${TARGET_RUN_EXERCISES:-RUN_EXERCISES}
# =================================
if [[ "$RUN_BASE" == "True" ]]; then
#echo_summary "Sourcing base DevStack config"
#source $BASE_DEVSTACK_DIR/stackrc
#echo_summary "Sourcing base DevStack config"
#source $BASE_DEVSTACK_DIR/stackrc
echo_summary "Running prep-base"
$GRENADE_DIR/prep-base
stop $STOP prep-base 01
echo_summary "Running prep-base"
$GRENADE_DIR/prep-base
stop $STOP prep-base 01
echo_summary "Running base stack.sh"
cd $BASE_DEVSTACK_DIR
./stack.sh
stop $STOP stack.sh 10
echo_summary "Running base stack.sh"
cd $BASE_DEVSTACK_DIR
./stack.sh
stop $STOP stack.sh 10
# Cache downloaded instances
# --------------------------
# Cache downloaded instances
# --------------------------
echo_summary "Caching downloaded images"
mkdir -p $BASE_RELEASE_DIR/images
echo "Images: $IMAGE_URLS"
for image_url in ${IMAGE_URLS//,/ }; do
IMAGE_FNAME=`basename "$image_url"`
if [[ -r $BASE_DEVSTACK_DIR/files/$IMAGE_FNAME ]]; then
rsync -av $BASE_DEVSTACK_DIR/files/$IMAGE_FNAME $BASE_RELEASE_DIR/images
fi
done
rsync -av $BASE_DEVSTACK_DIR/files/images/ $BASE_RELEASE_DIR/images
stop $STOP image-cache 20
echo_summary "Caching downloaded images"
mkdir -p $BASE_RELEASE_DIR/images
echo "Images: $IMAGE_URLS"
for image_url in ${IMAGE_URLS//,/ }; do
IMAGE_FNAME=`basename "$image_url"`
if [[ -r $BASE_DEVSTACK_DIR/files/$IMAGE_FNAME ]]; then
rsync -av $BASE_DEVSTACK_DIR/files/$IMAGE_FNAME $BASE_RELEASE_DIR/images
fi
done
rsync -av $BASE_DEVSTACK_DIR/files/images/ $BASE_RELEASE_DIR/images
stop $STOP image-cache 20
# Operation
# ---------
# Operation
# ---------
# Validate the install
echo_summary "Running base exercises"
if [[ "$BASE_RUN_EXERCISES" == "True" ]]; then
$BASE_DEVSTACK_DIR/exercise.sh
fi
stop $STOP base-exercise 110
# Validate the install
echo_summary "Running base exercises"
if [[ "$BASE_RUN_EXERCISES" == "True" ]]; then
$BASE_DEVSTACK_DIR/exercise.sh
fi
stop $STOP base-exercise 110
# Create a project, users and instances
echo_summary "Creating Javelin project"
$GRENADE_DIR/setup-javelin
stop $STOP setup-javelin 120
# Create a project, users and instances
echo_summary "Creating Javelin project"
$GRENADE_DIR/setup-javelin
stop $STOP setup-javelin 120
# Save some stuff before we shut that whole thing down
echo_summary "Saving current state information"
$GRENADE_DIR/save-state
stop $STOP save-state 130
# Save some stuff before we shut that whole thing down
echo_summary "Saving current state information"
$GRENADE_DIR/save-state
stop $STOP save-state 130
# Shut down running code
echo_summary "Shutting down base"
# unstack.sh is too aggressive in cleaning up by default
# so we'll do it ourselves...
$GRENADE_DIR/stop-base
stop $STOP stop-base 140
# Shut down running code
echo_summary "Shutting down base"
# unstack.sh is too aggressive in cleaning up by default
# so we'll do it ourselves...
$GRENADE_DIR/stop-base
stop $STOP stop-base 140
fi
@ -221,45 +225,45 @@ fi
# ========
if [[ "$RUN_TARGET" == "True" ]]; then
# Get target bits ready
echo_summary "Running prep-target"
$GRENADE_DIR/prep-target
stop $STOP prep-target 210
# Get target bits ready
echo_summary "Running prep-target"
$GRENADE_DIR/prep-target
stop $STOP prep-target 210
# Upgrade OS packages and known Python updates
echo_summary "Running upgrade-packages"
#$GRENADE_DIR/upgrade-packages
stop $STOP upgrade-packages 220
# Upgrade OS packages and known Python updates
echo_summary "Running upgrade-packages"
#$GRENADE_DIR/upgrade-packages
stop $STOP upgrade-packages 220
# Upgrade DevStack
echo_summary "Running upgrade-devstack"
#$GRENADE_DIR/upgrade-devstack
stop $STOP upgrade-devstack 230
# Upgrade DevStack
echo_summary "Running upgrade-devstack"
#$GRENADE_DIR/upgrade-devstack
stop $STOP upgrade-devstack 230
# Upgrade Keystone
echo_summary "Running upgrade-keystone"
$GRENADE_DIR/upgrade-keystone || die $LINENO "Failure in upgrade-keystone"
stop $STOP upgrade-keystone 240
# Upgrade Keystone
echo_summary "Running upgrade-keystone"
$GRENADE_DIR/upgrade-keystone || die $LINENO "Failure in upgrade-keystone"
stop $STOP upgrade-keystone 240
# Upgrade Glance
echo_summary "Running upgrade-glance"
$GRENADE_DIR/upgrade-glance || die $LINENO "Failure in upgrade-glancwe"
stop $STOP upgrade-glance 250
# Upgrade Glance
echo_summary "Running upgrade-glance"
$GRENADE_DIR/upgrade-glance || die $LINENO "Failure in upgrade-glancwe"
stop $STOP upgrade-glance 250
# Upgrade Nova
echo_summary "Running upgrade-nova"
$GRENADE_DIR/upgrade-nova || die $LINENO "Failure in upgrade-nova"
stop $STOP upgrade-nova 260
# Upgrade Nova
echo_summary "Running upgrade-nova"
$GRENADE_DIR/upgrade-nova || die $LINENO "Failure in upgrade-nova"
stop $STOP upgrade-nova 260
# Upgrade Cinder
echo_summary "Running upgrade-cinder"
$GRENADE_DIR/upgrade-cinder || die $LINENO "Failure in upgrade-cinder"
stop $STOP upgrade-cinder 270
# Upgrade Cinder
echo_summary "Running upgrade-cinder"
$GRENADE_DIR/upgrade-cinder || die $LINENO "Failure in upgrade-cinder"
stop $STOP upgrade-cinder 270
# Upgrade Swift
echo_summary "Running upgrade-swift"
$GRENADE_DIR/upgrade-swift || die $LINENO "Failure in upgrade-swift"
stop $STOP upgrade-swift 280
# Upgrade Swift
echo_summary "Running upgrade-swift"
$GRENADE_DIR/upgrade-swift || die $LINENO "Failure in upgrade-swift"
stop $STOP upgrade-swift 280
#Upgrade Tempest
if [[ "$ENABLE_TEMPEST" == "True" ]]; then
@ -269,27 +273,27 @@ if [[ "$RUN_TARGET" == "True" ]]; then
fi
# Upgrade Tests
# =============
# Upgrade Tests
# =============
# Validate the upgrade
echo_summary "Running target exercises"
if [[ "$TARGET_RUN_EXERCISES" == "True" ]]; then
$TARGET_DEVSTACK_DIR/exercise.sh
fi
stop $STOP target-exercise 310
# Validate the upgrade
echo_summary "Running target exercises"
if [[ "$TARGET_RUN_EXERCISES" == "True" ]]; then
$TARGET_DEVSTACK_DIR/exercise.sh
fi
stop $STOP target-exercise 310
# Save databases
# --------------
# Save databases
# --------------
echo_summary "Sourcing target DevStack config"
source $TARGET_DEVSTACK_DIR/stackrc
echo_summary "Dumping target databases"
mkdir -p $SAVE_DIR
for db in keystone glance nova cinder; do
mysqldump -uroot -p$MYSQL_PASSWORD $db >$SAVE_DIR/$db.sql.$TARGET_RELEASE
done
echo_summary "Sourcing target DevStack config"
source $TARGET_DEVSTACK_DIR/stackrc
echo_summary "Dumping target databases"
mkdir -p $SAVE_DIR
for db in keystone glance nova cinder; do
mysqldump -uroot -p$MYSQL_PASSWORD $db >$SAVE_DIR/$db.sql.$TARGET_RELEASE
done
fi

View File

@ -41,9 +41,9 @@ ssh -t $DEST_USER@$HOST " \
# Copy devstack.localrc if it exists
if [[ -r $SRC_DIR/devstack.localrc ]]; then
scp -p $SRC_DIR/devstack.localrc $DEST_USER@$HOST:$GRENADE_DIR
scp -p $SRC_DIR/devstack.localrc $DEST_USER@$HOST:$GRENADE_DIR
fi
# Copy localrc if it exists
if [[ -r $SRC_DIR/localrc ]]; then
scp -p $SRC_DIR/localrc $DEST_USER@$HOST:$GRENADE_DIR
scp -p $SRC_DIR/localrc $DEST_USER@$HOST:$GRENADE_DIR
fi

View File

@ -92,10 +92,10 @@ keystone-manage pki_setup || die $LINENO "PKI setup error"
extra=$(mysql -uroot -p$MYSQL_PASSWORD keystone -E -N -e "select extra from role where name = \"admin\";" | sed -n '2{p;q}')
if [[ "$extra" == "NULL" ]]; then
echo "1119789 not fixed???"
# Table 'role' column 'extra' is varchar(64) when upgraded from folsom
# and varchar(255) when created in trunk. The upgraded value is NULL
# while the trunk value is '{}'. Oops!
mysql -uroot -p$MYSQL_PASSWORD keystone -e "alter table role modify name varchar(255);update role set extra = '{}' where extra is NULL;"
# Table 'role' column 'extra' is varchar(64) when upgraded from folsom
# and varchar(255) when created in trunk. The upgraded value is NULL
# while the trunk value is '{}'. Oops!
mysql -uroot -p$MYSQL_PASSWORD keystone -e "alter table role modify name varchar(255);update role set extra = '{}' where extra is NULL;"
else
echo "Skipping 1119789 work-around"
fi
@ -113,7 +113,7 @@ function get_mysql_id() {
# get_mysql_roles <user-id>
function get_mysql_roles() {
local user_id=$1
local user_id=$1
if [[ -n "$user_id" ]]; then
echo $(mysql -u$MYSQL_USER -p$MYSQL_PASSWORD keystone -E -N -e "select data from user_project_metadata where user_id = \"$user_id\";" | sed -n '2{p;q}')
fi
@ -125,15 +125,15 @@ admin_id=$(get_mysql_id user admin)
if [[ "$(get_mysql_roles $admin_id)" == "{\"roles\": [\"9fe2ff9ee4384b1894a90878d3e92bab\"]}" ]]; then
echo "1131087 not fixed yet?"
WORK_AROUND_1131087=True
# Get admin role
role=$(get_mysql_id role admin)
# Add admin role where it is needed
for user in admin cinder glance nova swift; do
user_id=$(get_mysql_id user $user)
data=$(get_mysql_roles $user_id)
# Get admin role
role=$(get_mysql_id role admin)
# Add admin role where it is needed
for user in admin cinder glance nova swift; do
user_id=$(get_mysql_id user $user)
data=$(get_mysql_roles $user_id)
role_json='{\"roles\": [\"9fe2ff9ee4384b1894a90878d3e92bab\", \"'${role}'\"]}'
mysql -u$MYSQL_USER -p$MYSQL_PASSWORD keystone -e "update user_project_metadata set data = \"${role_json}\" where user_id = '${user_id}';"
done
done
else
echo "Skipping 1131087 work-around"
fi
@ -144,20 +144,20 @@ start_keystone
if [[ -n "$WORK_AROUND_1131087" ]]; then
### Continuation of 1131087 via API
source $TARGET_DEVSTACK_DIR/openrc admin admin
### Continuation of 1131087 via API
source $TARGET_DEVSTACK_DIR/openrc admin admin
# Fix admin
keystone user-role-remove --user admin --tenant admin --role _member_
# Fix admin
keystone user-role-remove --user admin --tenant admin --role _member_
# Fix demo
keystone user-role-remove --user demo --tenant demo --role _member_
keystone user-role-add --user demo --tenant demo --role Member
keystone user-role-add --user demo --tenant demo --role anotherrole
# Fix demo
keystone user-role-remove --user demo --tenant demo --role _member_
keystone user-role-add --user demo --tenant demo --role Member
keystone user-role-add --user demo --tenant demo --role anotherrole
# Fix javelin
keystone user-role-remove --user javelin --tenant javelin --role _member_
keystone user-role-add --user javelin --tenant javelin --role Member
# Fix javelin
keystone user-role-remove --user javelin --tenant javelin --role _member_
keystone user-role-add --user javelin --tenant javelin --role Member
fi