From 7d47107a469444e98dc1c53ce25f082ac9c89a50 Mon Sep 17 00:00:00 2001 From: Andreas Jaeger Date: Sat, 16 Dec 2017 15:44:45 +0100 Subject: [PATCH] Improve ensure-reno Follow I1334ff1f469061884b222dd99e72a989d72c68be and fail if constraints_file contains a file name that does not exist. Change-Id: I220bddabf24be5773c835635473e4b90e474eb09 --- roles/ensure-reno/tasks/main.yaml | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/roles/ensure-reno/tasks/main.yaml b/roles/ensure-reno/tasks/main.yaml index ac8ef063..91e447d1 100644 --- a/roles/ensure-reno/tasks/main.yaml +++ b/roles/ensure-reno/tasks/main.yaml @@ -6,13 +6,20 @@ - name: Check to see if the constraints file exists stat: - path: "{{ constraints_file|default('missing') }}" + path: "{{ constraints_file }}" get_checksum: false get_mime: false get_md5: false register: stat_results when: constraints_file is defined +- name: Fail if constraints file does not exist + fail: + msg: "Variable constraints_file is set but file does not exist." + when: + - constraints_file is defined + - not stat_results|skipped and not stat_results.stat.exists + - name: Record file location set_fact: upper_constraints: "-c {{ constraints_file }}"