Creates SWIFT_DATA_DIR if it does not exist

If SWIFT_DATA_DIR is set on local.conf we need to make sure to create
the directory with proper permissions

Change-Id: If29fa53f01b4c0c8a881ec3734383ecffac334ce
Closes-Bug: 1302893
This commit is contained in:
Geronimo Orozco 2015-03-19 12:08:23 -06:00
parent 2dc61b2a63
commit 2f6576bfaf

View File

@ -302,6 +302,7 @@ function configure_swift {
local node_number local node_number
local swift_node_config local swift_node_config
local swift_log_dir local swift_log_dir
local user_group
# Make sure to kill all swift processes first # Make sure to kill all swift processes first
swift-init --run-dir=${SWIFT_DATA_DIR}/run all stop || true swift-init --run-dir=${SWIFT_DATA_DIR}/run all stop || true
@ -505,10 +506,12 @@ EOF
fi fi
fi fi
local user_group=$(id -g ${STACK_USER})
sudo install -d -o ${STACK_USER} -g ${user_group} ${SWIFT_DATA_DIR}
local swift_log_dir=${SWIFT_DATA_DIR}/logs local swift_log_dir=${SWIFT_DATA_DIR}/logs
rm -rf ${swift_log_dir} sudo rm -rf ${swift_log_dir}
mkdir -p ${swift_log_dir}/hourly sudo install -d -o ${STACK_USER} -g adm ${swift_log_dir}/hourly
sudo chown -R ${STACK_USER}:adm ${swift_log_dir}
if [[ $SYSLOG != "False" ]]; then if [[ $SYSLOG != "False" ]]; then
sed "s,%SWIFT_LOGDIR%,${swift_log_dir}," $FILES/swift/rsyslog.conf | sudo \ sed "s,%SWIFT_LOGDIR%,${swift_log_dir}," $FILES/swift/rsyslog.conf | sudo \