Fix reset rescue skipping pod cleanup when there are no network namespaces (#13632)

With an empty 'ip netns list' (the common case), xargs without -r still
runs 'ip netns delete' once with no argument. That fails, so the && chain
short-circuits and 'crictl rmp -a -f' never runs: the rescue path leaves
the pod sandboxes behind, which is exactly what it is there to clean up.
Other tasks in the same file already use xargs -r.
This commit is contained in:
longxiucai
2026-10-12 09:01:36 +00:00
committed by GitHub
parent c5dd17b5cb
commit 69ad777b45
+1 -1
View File
@@ -131,7 +131,7 @@
rescue:
- name: Reset | force remove all cri pods (rescue)
shell: "ip netns list | cut -d' ' -f 1 | xargs -n1 ip netns delete && {{ bin_dir }}/crictl rmp -a -f"
shell: "ip netns list | cut -d' ' -f 1 | xargs -r -n1 ip netns delete && {{ bin_dir }}/crictl rmp -a -f"
ignore_errors: true # noqa ignore-errors
changed_when: true