From 183e186fe0bc8da2dce8f187ba42ac75a5825d5c Mon Sep 17 00:00:00 2001 From: Clark Boylan Date: Wed, 14 Sep 2022 08:12:59 -0700 Subject: [PATCH] Fix error checking with zuul graceful stops The previous code had attempted to handle the case where the container isn't running and we exec a zuul graceful stop in the container. Unfortunately I got the string to check for wrong. I think I must've checked the `docker exec` output and not the `docker-compose exec` output. This change updates the string to match exactly what ansible complained about: TASK [zuul-merger : Gracefully stop Zuul Merger] ******************************* fatal: [zm05.opendev.org]: FAILED! => { "changed": true, "cmd": "docker-compose exec merger zuul-merger stop", "delta": "0:00:00.573561", "end": "2022-09-14 01:59:41.721044", "failed_when_result": true, "rc": 1, "start": "2022-09-14 01:59:41.147483" } STDERR: No container found for merger_1 MSG: non-zero return code Specifically we check for 'No container found' in stderr. Change-Id: I737b9da14c210215926804816d1e032540d694dc --- playbooks/roles/zuul-executor/tasks/graceful.yaml | 2 +- playbooks/roles/zuul-merger/tasks/graceful.yaml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/playbooks/roles/zuul-executor/tasks/graceful.yaml b/playbooks/roles/zuul-executor/tasks/graceful.yaml index a2bca090a6..5e1466f6f7 100644 --- a/playbooks/roles/zuul-executor/tasks/graceful.yaml +++ b/playbooks/roles/zuul-executor/tasks/graceful.yaml @@ -19,7 +19,7 @@ failed_when: - ze_graceful.rc != 0 # If the exec fails because the container is not running we continue. - - "'is not running' not in ze_graceful.stderr" + - "'No container found' not in ze_graceful.stderr" - name: Wait for Zuul Executor to stop shell: cmd: docker-compose ps -q | xargs docker wait diff --git a/playbooks/roles/zuul-merger/tasks/graceful.yaml b/playbooks/roles/zuul-merger/tasks/graceful.yaml index 233f17c636..62c52f1135 100644 --- a/playbooks/roles/zuul-merger/tasks/graceful.yaml +++ b/playbooks/roles/zuul-merger/tasks/graceful.yaml @@ -26,7 +26,7 @@ # the overall graceful shutdown. - zm_graceful.rc != 137 # If the exec fails because the container is not running we continue. - - "'is not running' not in zm_graceful.stderr" + - "'No container found' not in zm_graceful.stderr" - name: Wait for Zuul Merger to stop shell: cmd: docker-compose ps -q | xargs docker wait