Purge filebucket contents after every apply

Since filebucket doesn't have a built in cleanup mechanism, filebucket
entries will continually grow over time as puppet implements file
changes. Eventually, this will have space and inode impacts on the root
filesystem.

To avoid these issues on long running systems, remove the contents of
the filebucket directory after every apply.

Change-Id: I02519b9f61b0c1b95ceeca073448f42851ed9551
Story: 2007101
Task: 38155
Signed-off-by: Robert Church <robert.church@windriver.com>
This commit is contained in:
Robert Church 2020-01-16 02:36:55 -05:00
parent b2d4e41822
commit 58bc99d891
1 changed files with 7 additions and 0 deletions

View File

@ -23,6 +23,7 @@ RUNTIMEDATA=$5
PUPPET_MODULES_PATH=/usr/share/puppet/modules:/usr/share/openstack-puppet/modules
PUPPET_MANIFEST=/etc/puppet/manifests/${MANIFEST}.pp
PUPPET_TMP=/tmp/puppet
FILEBUCKET_PATH=/var/lib/puppet/clientbucket
# Setup log directory and file
DATETIME=$(date -u +"%Y-%m-%d-%H-%M-%S")
@ -86,6 +87,12 @@ function finish {
# Save the logs
tar czf ${SAVEDLOGS} ${LOGDIR} 2>/dev/null
fi
# To avoid the ever growing contents of filebucket which may trigger inode
# issues, clean up its contents after every apply.
if [ -d ${FILEBUCKET_PATH} ]; then
rm -fr ${FILEBUCKET_PATH}/*
fi
}
trap finish EXIT