From dc890ee30d5220d9ebfe0b051b2393ffbeffd736 Mon Sep 17 00:00:00 2001 From: Olivier Bourdon Date: Fri, 16 Mar 2018 12:49:10 +0100 Subject: [PATCH] Add more infos into error message It is way more convenient to tell the user exactly how much space was found and what is the minimal size required instead of forcing him to go through the source code. Change-Id: I6aafca34ba9dc3a3a45a3ac01848eefeca2ad03d --- .../tasks/check-requirements.yml | 36 ++++++++++++++----- 1 file changed, 28 insertions(+), 8 deletions(-) diff --git a/tests/roles/bootstrap-host/tasks/check-requirements.yml b/tests/roles/bootstrap-host/tasks/check-requirements.yml index 58782b4fbb..9d46209b50 100644 --- a/tests/roles/bootstrap-host/tasks/check-requirements.yml +++ b/tests/roles/bootstrap-host/tasks/check-requirements.yml @@ -73,22 +73,42 @@ tags: - check-disk-size -- name: Fail if there is not enough space available in / - assert: - that: | - (host_root_space_available_bytes | int) >= (host_data_disk_min_size_bytes | int) +- name: Set size facts + set_fact: + root_gb_available: "{{ ((host_root_space_available_bytes | int ) / 1024**3) | round(2, 'floor') }}" when: bootstrap_host_data_disk_device == None tags: - check-disk-size -- name: Fail if there is not enough disk space available (disk specified) - assert: - that: | - (host_data_disk_size_bytes | int) >= (host_data_disk_min_size_bytes | int) +- name: Set disk size facts + set_fact: + disk_gb_available: "{{ ((host_data_disk_size_bytes | int ) / 1024**3) | round(2, 'floor') }}" when: bootstrap_host_data_disk_device != None tags: - check-disk-size +- name: Fail if there is not enough space available in / + fail: + msg: | + Not enough space available in /. + Found {{ root_gb_available }} GB, required {{ bootstrap_host_data_disk_min_size }} GB) + when: + - bootstrap_host_data_disk_device == None + - (host_root_space_available_bytes | int) < (host_data_disk_min_size_bytes | int) + tags: + - check-disk-size + +- name: Fail if there is not enough disk space available (disk specified) + fail: + msg: | + Not enough disk space available. + Found {{ disk_gb_available }} GB, required {{ bootstrap_host_data_disk_min_size }} GB) + when: + - bootstrap_host_data_disk_device != None + - (host_data_disk_size_bytes | int) < (host_data_disk_min_size_bytes | int) + tags: + - check-disk-size + - name: Ensure that the kernel has VXLAN support modprobe: name: vxlan