From 2f6576bfaf7f43d9bf820e3e5ecc0b7fd136ce3c Mon Sep 17 00:00:00 2001 From: Geronimo Orozco Date: Thu, 19 Mar 2015 12:08:23 -0600 Subject: [PATCH] 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 --- lib/swift | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/lib/swift b/lib/swift index af19c68a1b..0fd671160e 100644 --- a/lib/swift +++ b/lib/swift @@ -302,6 +302,7 @@ function configure_swift { local node_number local swift_node_config local swift_log_dir + local user_group # Make sure to kill all swift processes first swift-init --run-dir=${SWIFT_DATA_DIR}/run all stop || true @@ -505,10 +506,12 @@ EOF 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 - rm -rf ${swift_log_dir} - mkdir -p ${swift_log_dir}/hourly - sudo chown -R ${STACK_USER}:adm ${swift_log_dir} + sudo rm -rf ${swift_log_dir} + sudo install -d -o ${STACK_USER} -g adm ${swift_log_dir}/hourly if [[ $SYSLOG != "False" ]]; then sed "s,%SWIFT_LOGDIR%,${swift_log_dir}," $FILES/swift/rsyslog.conf | sudo \