From ff4dc83b87c31269106d7c0c7e475e7a08e96b06 Mon Sep 17 00:00:00 2001 From: Rishabh Dave Date: Wed, 10 Oct 2018 02:17:40 +0530 Subject: [PATCH] ceph-validate: avoid "list index out of range" error Be sure that error.path has more than one members before using them. Signed-off-by: Rishabh Dave --- plugins/actions/validate.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/plugins/actions/validate.py b/plugins/actions/validate.py index 5cedd83e7..e6e40f9fe 100644 --- a/plugins/actions/validate.py +++ b/plugins/actions/validate.py @@ -102,7 +102,12 @@ class ActionModule(ActionBase): reason = "[{}] Reason: {}".format(host, error.reason) try: if "schema is missing" not in error.message: - given = "[{}] Given value for {}: {}".format(host, error.path[0], error.path[1]) + for i in range(0, len(error.path)): + if i == 0: + given = "[{}] Given value for {}".format( + host, error.path[0]) + else: + given = given + ": {}".format(error.path[i]) display.error(given) else: given = "" -- 2.47.3