Use install instead of mkdir for DevStack dirs
The current code will not work if WATCHER_CONF_DIR or WATCHER_AUTH_CACHE_DIR already exist but are owned by a different user such as root. Use install instead of mkdir to handle this scenario. Change-Id: Ie582a4b393e898e007d73f31de490c4b77e40be3 Closes-Bug: #1539422
This commit is contained in:
parent
de307e536e
commit
278b1819d6
|
@ -80,10 +80,7 @@ function cleanup_watcher {
|
|||
# configure_watcher() - Set config files, create data dirs, etc
|
||||
function configure_watcher {
|
||||
# Put config files in ``/etc/watcher`` for everyone to find
|
||||
if [[ ! -d $WATCHER_CONF_DIR ]]; then
|
||||
sudo mkdir -p $WATCHER_CONF_DIR
|
||||
sudo chown $STACK_USER $WATCHER_CONF_DIR
|
||||
fi
|
||||
sudo install -d -o $STACK_USER $WATCHER_CONF_DIR
|
||||
|
||||
install_default_policy watcher
|
||||
|
||||
|
@ -178,9 +175,8 @@ function create_watcher_conf {
|
|||
# create_watcher_cache_dir() - Part of the init_watcher() process
|
||||
function create_watcher_cache_dir {
|
||||
# Create cache dir
|
||||
sudo mkdir -p $WATCHER_AUTH_CACHE_DIR
|
||||
sudo chown $STACK_USER $WATCHER_AUTH_CACHE_DIR
|
||||
rm -f $WATCHER_AUTH_CACHE_DIR/*
|
||||
sudo install -d -o $STACK_USER $WATCHER_AUTH_CACHE_DIR
|
||||
rm -rf $WATCHER_AUTH_CACHE_DIR/*
|
||||
}
|
||||
|
||||
# init_watcher() - Initialize databases, etc.
|
||||
|
|
Loading…
Reference in New Issue