From 0eb09e7b4f4c2f937b5303d35af5f04af5525f31 Mon Sep 17 00:00:00 2001 From: Pierre-Louis Bonicoli Date: Mon, 14 Sep 2020 09:48:25 +0200 Subject: [PATCH] explicit error when test_command is undef Don't use a shell builtin: shell builtins aren't available since 'command' ansible module is used. Instead, fail with an explicit error when the required test_command variable is not set. Fix this error: Ansible output: b'failed: [host] (item=exit 1) => { "ansible_loop_var": "item", "changed": false, "cmd": "exit 1", "item": "exit 1", "msg": "[Errno 2] No such file or directory: 'exit': 'exit'", "rc": 2 } Change-Id: I88303f7302d7354ffc8b18e607b28349a9860a57 --- playbooks/run-test-command/run.yaml | 5 +++++ zuul.d/general-jobs.yaml | 2 -- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/playbooks/run-test-command/run.yaml b/playbooks/run-test-command/run.yaml index ceb02475f..d6cdee50d 100644 --- a/playbooks/run-test-command/run.yaml +++ b/playbooks/run-test-command/run.yaml @@ -1,6 +1,11 @@ - hosts: all tasks: + - name: Abort when test_command variable is undefined + fail: + msg: mandatory test_command variable is undefined + when: test_command is undefined + - name: Convert test_command to list set_fact: test_commands: ['{{ test_command }}'] diff --git a/zuul.d/general-jobs.yaml b/zuul.d/general-jobs.yaml index d7cd3a41b..5682c01fe 100644 --- a/zuul.d/general-jobs.yaml +++ b/zuul.d/general-jobs.yaml @@ -40,8 +40,6 @@ Path to operate in. run: playbooks/run-test-command/run.yaml - vars: - test_command: "exit 1" - job: name: upload-git-mirror