diff --git a/clean.sh b/clean.sh index 685a719cfb..cb0a8b4bef 100755 --- a/clean.sh +++ b/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 diff --git a/functions-common b/functions-common index ffbd631fb2..547f6df038 100644 --- a/functions-common +++ b/functions-common @@ -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 diff --git a/unstack.sh b/unstack.sh index 276111edb9..3197cf136f 100755 --- a/unstack.sh +++ b/unstack.sh @@ -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