--- /dev/null
+---
+fixes:
+ - |
+ Addresses a bug whereby the openstack orphaned objects/ports scripts
+ exit early with an error when grep/awk do not match any orphaned
+ objects. The fix allows jobs using the scripts to continue when no
+ cleanups operations are required.
if [[ -n ${filters} ]]; then
# If a filter/match condition is requested/set
openstack --os-cloud "$os_cloud" "${object}" list -f value -c ID $attributes \
- | $filters | awk '{print $1}'> "$tmpfile"
+ | { $filters || true; } | { awk '{print $1}' || true; } > "$tmpfile"
else
# Otherwise don't pipe through an additional command
openstack --os-cloud "$os_cloud" "${object}" list -f value -c ID $attributes \
- | awk '{print $1}'> "$tmpfile"
+ | { awk '{print $1}' || true; } > "$tmpfile"
fi
# Count the number of objects to process
# Export variables and send to parallel for processing
export -f _cleanup
export os_cloud cutoff age object
-# parallel --progress --retries 3 -j "$threads" _cleanup < "$tmpfile"
+# Add --progress flag to the command below for additional debug output
parallel --retries 3 -j "$threads" _cleanup < "$tmpfile"
rm "$tmpfile"
}
# Output the initial list of port UUIDs to a temporary file
-openstack --os-cloud "$os_cloud" port list -f value -c ID -c status | grep -e DOWN | awk '{print $1}'> "$tmpfile"
+openstack --os-cloud "$os_cloud" port list -f value -c ID -c status \
+ | { grep -e DOWN || true; } | { awk '{print $1}' || true; } > "$tmpfile"
# Count the number to process
total=$(wc -l "$tmpfile" | awk '{print $1}')