move cleanup of pyc files
Previously pyc files were only cleaned if clean.sh was run. with this change a new clean_pyc_files function was introduced with the logic that was previously in clean.sh but it is now invoked from unstack.sh With the previous behavior you could not stack with horizon enabled then unstack and stack again due to the presence of pyc files that were owned by root. By moving the clean to unstack in stead of clean.sh you can now stack, unstack and stack again without hitting the pyc issue. since unstack is invoked by clean the existing clean.sh behavior has not changed in practice except for the fact the pyc files are removed sooner in the process. This change also removes support for findutils < 4.2.3 Ubuntu 12.04 and CentOS 6 both have 4.4.2 since they were released 8 years ago and are now EOL its fair to assume that all modern distros have 4.2.3+ https://repology.org/project/findutils/versions Change-Id: I13c9aad9be7e0930a0d875b7d382090caf0b8982
This commit is contained in:
parent
18b4251bf4
commit
ae21b3556f
9
clean.sh
9
clean.sh
@ -145,12 +145,3 @@ done
|
||||
|
||||
rm -rf ~/.config/openstack
|
||||
|
||||
# Clean up all *.pyc files
|
||||
if [[ -n "$DEST" ]] && [[ -d "$DEST" ]]; then
|
||||
find_version=`find --version | awk '{ print $NF; exit}'`
|
||||
if vercmp "$find_version" "<" "4.2.3" ; then
|
||||
sudo find $DEST -name "*.pyc" -print0 | xargs -0 rm
|
||||
else
|
||||
sudo find $DEST -name "*.pyc" -delete
|
||||
fi
|
||||
fi
|
||||
|
@ -2415,6 +2415,13 @@ function time_totals {
|
||||
$xtrace
|
||||
}
|
||||
|
||||
function clean_pyc_files {
|
||||
# Clean up all *.pyc files
|
||||
if [[ -n "$DEST" ]] && [[ -d "$DEST" ]]; then
|
||||
sudo find $DEST -name "*.pyc" -delete
|
||||
fi
|
||||
}
|
||||
|
||||
# Restore xtrace
|
||||
$_XTRACE_FUNCTIONS_COMMON
|
||||
|
||||
|
@ -182,3 +182,5 @@ if is_service_enabled cinder && is_package_installed lvm2; then
|
||||
clean_lvm_volume_group $DEFAULT_VOLUME_GROUP_NAME || /bin/true
|
||||
clean_lvm_filter
|
||||
fi
|
||||
|
||||
clean_pyc_files
|
||||
|
Loading…
Reference in New Issue
Block a user