Skip to content

Commit

Permalink
Only modify folders created by devstack
Browse files Browse the repository at this point in the history
running chown and chmod on files and folders not created by
devstack causes a few issues:

* On nfs mounted directories it can take an extremely
  long time to chown -R some of the git repos, especially
  if any tox commands have been ran in the host
* chown can cause the host files to get into a weird state
  if nfs is set up wrong.

If files and folders are pre-existing we should assume
they are in the correct state, and not modify them.

Fix setup-devstack-log-dir to create the logs directory with
correct permissions in the first place.

Change-Id: I5ebdaded3ffd0a5bc70c5e9ab5b18daefb358f58
Signed-off-by: Graham Hayes <gr@ham.ie>
  • Loading branch information
grahamhayes committed Jul 26, 2019
1 parent 6aeaceb commit 352d58a
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 6 deletions.
3 changes: 3 additions & 0 deletions roles/setup-devstack-log-dir/tasks/main.yaml
Expand Up @@ -2,4 +2,7 @@
file:
path: '{{ devstack_base_dir }}/logs'
state: directory
mode: 0755
owner: stack
group: stack
become: yes
11 changes: 11 additions & 0 deletions roles/sync-devstack-data/tasks/main.yaml
Expand Up @@ -46,3 +46,14 @@
dest: "{{ devstack_data_base_dir }}/data/"
mode: push
when: 'inventory_hostname in groups["subnode"]|default([])'

- name: Ensure the data folder and subfolders have the correct permissions
become: true
file:
path: "{{ devstack_data_base_dir }}/data"
state: directory
owner: stack
group: stack
mode: 0755
recurse: yes
when: 'inventory_hostname in groups["subnode"]|default([])'
17 changes: 11 additions & 6 deletions stack.sh
Expand Up @@ -365,9 +365,12 @@ DEST=${DEST:-/opt/stack}

# Create the destination directory and ensure it is writable by the user
# and read/executable by everybody for daemons (e.g. apache run for horizon)
sudo mkdir -p $DEST
safe_chown -R $STACK_USER $DEST
safe_chmod 0755 $DEST
# If directory exists do not modify the permissions.
if [[ ! -d $DEST ]]; then
sudo mkdir -p $DEST
safe_chown -R $STACK_USER $DEST
safe_chmod 0755 $DEST
fi

# Destination path for devstack logs
if [[ -n ${LOGDIR:-} ]]; then
Expand All @@ -376,9 +379,11 @@ fi

# Destination path for service data
DATA_DIR=${DATA_DIR:-${DEST}/data}
sudo mkdir -p $DATA_DIR
safe_chown -R $STACK_USER $DATA_DIR
safe_chmod 0755 $DATA_DIR
if [[ ! -d $DATA_DIR ]]; then
sudo mkdir -p $DATA_DIR
safe_chown -R $STACK_USER $DATA_DIR
safe_chmod 0755 $DATA_DIR
fi

# Configure proper hostname
# Certain services such as rabbitmq require that the local hostname resolves
Expand Down

0 comments on commit 352d58a

Please sign in to comment.