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 <vipin.indiasmg@gmail.com>
pull/3301/head
VasishtaShastry 2018-10-28 23:07:21 +05:30 committed by Sébastien Han
parent 21f9126fc4
commit 098f42f233
1 changed files with 10 additions and 2 deletions

View File

@ -155,6 +155,14 @@ def validate_monitor_options(value):
assert any([monitor_address_given, monitor_address_block_given, monitor_interface_given]), msg 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): def validate_osd_scenarios(value):
assert value in ["collocated", "non-collocated", "lvm"], "osd_scenario must be set to 'collocated', 'non-collocated' or 'lvm'" 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 = ( osd_options = (
(optional("dmcrypt"), types.boolean), (optional("dmcrypt"), validate_dmcrypt_bool_value),
(optional("osd_auto_discovery"), types.boolean), (optional("osd_auto_discovery"), validate_osd_auto_discovery_bool_value),
("osd_scenario", validate_osd_scenarios), ("osd_scenario", validate_osd_scenarios),
) )