diff options
| author | Michal Arbet <michal.arbet@ultimum.io> | 2024-02-08 15:25:12 +0100 |
|---|---|---|
| committer | Michal Arbet <michal.arbet@ultimum.io> | 2024-09-16 10:15:45 +0200 |
| commit | 18899a7d525bc4b4d2e547e78d4b7aa9ec9645a0 (patch) | |
| tree | 35b989eb770f8367bff18555eb43df2926a53507 /tools/cleanup-host | |
| parent | f17d3dfd971c9a1e94833341d5dc761911a7336f (diff) | |
| download | kolla-ansible-18899a7d525bc4b4d2e547e78d4b7aa9ec9645a0.tar.gz kolla-ansible-18899a7d525bc4b4d2e547e78d4b7aa9ec9645a0.zip | |
Do not remove inventory file if placed in /etc/kolla
This patch fix issue when inventory file is deleted
by kolla-ansible -i /etc/kolla/inventory destroy call.
Now, inventories are available in tools/cleanup-host
so we can ignore their removal.
Closes-Bug: #2052706
Change-Id: If89e94356de515b40ca4e8c023979cd498146303
Diffstat (limited to 'tools/cleanup-host')
| -rwxr-xr-x | tools/cleanup-host | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/tools/cleanup-host b/tools/cleanup-host index b0dfb4782..fc6e94320 100755 --- a/tools/cleanup-host +++ b/tools/cleanup-host @@ -77,14 +77,27 @@ fi echo "Getting folders name..." for dir in $FOLDER_PATH/*; do + skip="false" + + for inventory in $kolla_ansible_inventories; do + if [ "$dir" == "$inventory" ]; then + skip="true" + break + fi + done + if [ "$dir" == "$FOLDER_PATH/passwords.yml" ] || \ [ "$dir" == "$FOLDER_PATH/globals.yml" ] || \ [ "$dir" == "$FOLDER_PATH/globals.d" ] || \ [ "$dir" == "$FOLDER_PATH/kolla-build.conf" ] || \ [ "$dir" == "$FOLDER_PATH/config" ] || \ [ "$dir" == "$FOLDER_PATH/certificates" ]; then - echo "Skipping:" $dir - else + echo "Skipping: $dir" + skip="true" + fi + + # If it's not to be skipped, remove it + if [ "$skip" == "false" ]; then rm -rfv $dir fi done |
