Browse Source

Merge "Ensures monasca-thresh data and worker dirs exist and are empty on start up" into stable/stein

tags/8.0.1
Zuul 1 month ago
parent
commit
003b83cf02
1 changed files with 30 additions and 1 deletions
  1. 30
    1
      docker/monasca/monasca-thresh/extend_start.sh

+ 30
- 1
docker/monasca/monasca-thresh/extend_start.sh View File

@@ -1,15 +1,44 @@
1 1
 #!/bin/bash
2 2
 
3
-# Create log directory, with appropriate permissions
3
+# Create log and data directories, with appropriate permissions
4 4
 MONASCA_LOG_DIR="/var/log/kolla/monasca"
5
+MONASCA_DATA_DIR="/var/lib/monasca-thresh/data"
6
+MONASCA_WORKER_DIR="/var/lib/monasca-thresh/worker-artifacts"
5 7
 if [[ ! -d "$MONASCA_LOG_DIR" ]]; then
6 8
     mkdir -p $MONASCA_LOG_DIR
7 9
 fi
10
+if [[ ! -d "$MONASCA_DATA_DIR" ]]; then
11
+    mkdir -p $MONASCA_DATA_DIR
12
+fi
13
+if [[ ! -d "$MONASCA_WORKER_DIR" ]]; then
14
+    mkdir -p $MONASCA_WORKER_DIR
15
+fi
8 16
 if [[ $(stat -c %U:%G ${MONASCA_LOG_DIR}) != "monasca:kolla" ]]; then
9 17
     chown monasca:kolla ${MONASCA_LOG_DIR}
10 18
 fi
19
+if [[ $(stat -c %U:%G ${MONASCA_DATA_DIR}) != "monasca:kolla" ]]; then
20
+    chown monasca:kolla ${MONASCA_DATA_DIR}
21
+fi
22
+if [[ $(stat -c %U:%G ${MONASCA_WORKER_DIR}) != "monasca:kolla" ]]; then
23
+    chown monasca:kolla ${MONASCA_WORKER_DIR}
24
+fi
11 25
 if [[ $(stat -c %a ${MONASCA_LOG_DIR}) != "755" ]]; then
12 26
     chmod 755 ${MONASCA_LOG_DIR}
13 27
 fi
28
+if [[ $(stat -c %a ${MONASCA_DATA_DIR}) != "755" ]]; then
29
+    chmod 755 ${MONASCA_DATA_DIR}
30
+fi
31
+if [[ $(stat -c %a ${MONASCA_WORKER_DIR}) != "755" ]]; then
32
+    chmod 755 ${MONASCA_WORKER_DIR}
33
+fi
34
+
35
+# Delete the contents of data and worker-artifacts directories as
36
+# Apache Storm doesn't clear temp files unless shutdown gracefully.
37
+if [[ $(ls -Ab ${MONASCA_DATA_DIR}) != "" ]]; then
38
+    find ${MONASCA_DATA_DIR} -mindepth 1 -delete
39
+fi
40
+if [[ $(ls -Ab ${MONASCA_WORKER_DIR}) != "" ]]; then
41
+    find ${MONASCA_WORKER_DIR} -mindepth 1 -delete
42
+fi
14 43
 
15 44
 . /usr/local/bin/kolla_monasca_extend_start

Loading…
Cancel
Save