From ff3a73f37dfadb46eccb72ebe8a57e30148c6a69 Mon Sep 17 00:00:00 2001 From: Mark Goddard Date: Thu, 20 Dec 2018 15:47:01 +0000 Subject: [PATCH] Check for specific error messages in ironic version check When checking for the 1.34 ironic API version for physnet support, explicitly check for known error messages to make it more robust. Change-Id: I8c42e85c8b3abe8712879c5737d85ee72e231f9e --- ansible/roles/ironic-enrolment/tasks/main.yml | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/ansible/roles/ironic-enrolment/tasks/main.yml b/ansible/roles/ironic-enrolment/tasks/main.yml index eecce70..581ead1 100644 --- a/ansible/roles/ironic-enrolment/tasks/main.yml +++ b/ansible/roles/ironic-enrolment/tasks/main.yml @@ -61,7 +61,12 @@ baremetal node list register: api_version_result changed_when: false - failed_when: false + failed_when: + - api_version_result.rc != 0 + # 'invalid choice' if the client doesn't support 1.34. + - "'invalid choice' not in api_version_result.stderr" + # 'not supported' if the server doesn't support 1.34. + - "'not supported' not in api_version_result.stderr" # This is used in port.yml. - name: Set a fact about whether Ironic supports physical network awareness