From f17140c03d49164945f97c4b2a5dd14fe6163b80 Mon Sep 17 00:00:00 2001 From: VasishtaShastry Date: Sun, 28 Oct 2018 23:07:21 +0530 Subject: [PATCH] ceph-validate : Added functions to accept true and flase ceph-validate used to throw error for setting flags as 'true' or 'false' for True and False Now user can set the flags 'dmcrypt' and 'osd_auto_discovery' as 'true' or 'false' Will fix - Bug 1638325 Signed-off-by: VasishtaShastry (cherry picked from commit 098f42f2334c442bf418f09d3f4b3b99750c7ba0) --- plugins/actions/validate.py | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/plugins/actions/validate.py b/plugins/actions/validate.py index 552c55b1c..620358eae 100644 --- a/plugins/actions/validate.py +++ b/plugins/actions/validate.py @@ -155,6 +155,14 @@ def validate_monitor_options(value): assert any([monitor_address_given, monitor_address_block_given, monitor_interface_given]), msg +def validate_dmcrypt_bool_value(value): + assert value in ["true", True, "false", False], "dmcrypt can be set to true/True or false/False (default)" + + +def validate_osd_auto_discovery_bool_value(value): + assert value in ["true", True, "false", False], "osd_auto_discovery can be set to true/True or false/False (default)" + + def validate_osd_scenarios(value): assert value in ["collocated", "non-collocated", "lvm"], "osd_scenario must be set to 'collocated', 'non-collocated' or 'lvm'" @@ -222,8 +230,8 @@ rados_options = ( ) osd_options = ( - (optional("dmcrypt"), types.boolean), - (optional("osd_auto_discovery"), types.boolean), + (optional("dmcrypt"), validate_dmcrypt_bool_value), + (optional("osd_auto_discovery"), validate_osd_auto_discovery_bool_value), ("osd_scenario", validate_osd_scenarios), )