Skip to content

Commit e4cb65f

Browse files
quick_setup: fix off by one error
When there was only one error when submitting the quick setup configuration, the wrong stage index would be printed (zero based index). Let's normalize the stages in one go, making it based on 1. CMK-21713 Change-Id: I5890c0d825ce3e4f7ba77d012f5c6afffc735c49
1 parent 477eef4 commit e4cb65f

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

cmk/gui/openapi/endpoints/quick_setup/__init__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -466,13 +466,13 @@ def _add_summary_error_message(
466466
all_stage_errors.extend(current_errors)
467467

468468
faulty_stage_indices = [
469-
err.stage_index for err in current_errors if err.stage_index is not None
469+
err.stage_index + 1 for err in current_errors if err.stage_index is not None
470470
]
471471
faulty_stage_indices.sort()
472472

473473
msg = (
474474
_("Stages %s contain invalid form data. Please correct them and try again.")
475-
% ", ".join(str(index + 1) for index in faulty_stage_indices)
475+
% ", ".join(str(index) for index in faulty_stage_indices)
476476
if len(faulty_stage_indices) > 1
477477
else _("Stage %s contains invalid form data. Please correct them and try again.")
478478
% faulty_stage_indices[0]

0 commit comments

Comments
 (0)