From a7b8708dfcc6bfcee8463ec8435b0360cbb93950 Mon Sep 17 00:00:00 2001 From: Yousong Zhou Date: Wed, 10 Jun 2020 18:22:08 +0800 Subject: [PATCH] calico: use absolute path to docker, crictl binary (#6253) To avoid the following error (ignored when pipefail is off) RUNNING HANDLER [network_plugin/calico : containerd | delete calico-node containers] ******************************************************************************* changed: [node1] => {"attempts": 1, "changed": true, "cmd": "crictl pods --name calico-node-* -q | xargs -I% --no-run-if-empty bash -c \"crictl stopp % && crictl rmp %\"", "delta": "0:00:00.004240", "end": "2020-06-10 03:32:41.316955", "rc": 0, "start": "2020-06-10 03:32:41.312715", "stderr": "/bin/sh: crictl: command not found", "stderr_lines": ["/bin/sh: crictl: command not found"], "stdout": "", "stdout_lines": []} --- roles/network_plugin/calico/handlers/main.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/roles/network_plugin/calico/handlers/main.yml b/roles/network_plugin/calico/handlers/main.yml index 2c19347b2..75fe2296c 100644 --- a/roles/network_plugin/calico/handlers/main.yml +++ b/roles/network_plugin/calico/handlers/main.yml @@ -12,14 +12,14 @@ state: absent - name: docker | delete calico-node containers - shell: "docker ps -af name=k8s_POD_calico-node* -q | xargs --no-run-if-empty docker rm -f" + shell: "{{ docker_bin_dir }}/docker ps -af name=k8s_POD_calico-node* -q | xargs --no-run-if-empty {{ docker_bin_dir }}/docker rm -f" register: docker_calico_node_remove until: docker_calico_node_remove is succeeded retries: 5 when: container_manager in ["docker"] - name: containerd | delete calico-node containers - shell: 'crictl pods --name calico-node-* -q | xargs -I% --no-run-if-empty bash -c "crictl stopp % && crictl rmp %"' + shell: '{{ bin_dir }}/crictl pods --name calico-node-* -q | xargs -I% --no-run-if-empty bash -c "{{ bin_dir }}/crictl stopp % && {{ bin_dir }}/crictl rmp %"' register: crictl_calico_node_remove until: crictl_calico_node_remove is succeeded retries: 5