From e5d06a449f9376b5764667f67778f02f54a63fae Mon Sep 17 00:00:00 2001 From: Douglas Fuller Date: Mon, 3 Jul 2017 15:10:16 +0000 Subject: [PATCH] osd: validate devices variable input Fail with a sane message if the devices or raw_journal_devices variables are strings instead of lists during manual device assignment. Signed-off-by: Douglas Fuller --- roles/ceph-osd/tasks/check_mandatory_vars.yml | 21 +++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/roles/ceph-osd/tasks/check_mandatory_vars.yml b/roles/ceph-osd/tasks/check_mandatory_vars.yml index 9def8abf4..652cacbaa 100644 --- a/roles/ceph-osd/tasks/check_mandatory_vars.yml +++ b/roles/ceph-osd/tasks/check_mandatory_vars.yml @@ -55,6 +55,15 @@ - not osd_auto_discovery - devices|length == 0 +- name: make sure the devices variable is a list + fail: + msg: "devices: must be a list, not a string, i.e. [ \"/dev/sda\" ]" + when: + - osd_group_name is defined + - osd_group_name in group_names + - not osd_auto_discovery + - devices is string + - name: verify journal devices have been provided fail: msg: "please provide devices and raw journal devices to your osd scenario" @@ -66,6 +75,18 @@ - raw_journal_devices|length == 0 or devices|length == 0 +- name: make sure the raw_journal_devices variable is a list + fail: + msg: "raw_journal_devices: must be a list, not a string, i.e. [ \"/dev/sda\" ]" + when: + - osd_group_name is defined + - osd_group_name in group_names + - not containerized_deployment + - raw_multi_journal + - raw_journal_devices is string + - raw_journal_devices|length == 0 + or devices|length == 0 + - name: check if bluestore is supported by the selected ceph version fail: msg: "bluestore is not supported by the selected Ceph version, use Luminous or above."