Skip to content

Commit e2cd3df

Browse files
authored
fix: Allow --reset or --init on reindex_studio as no-ops (#38434)
Allowing these flags as no-ops for backcompat will smooth out the transition for developers and operators. Follows up on: 9af9d8f Related: overhangio/tutor#1374
1 parent cb86181 commit e2cd3df

2 files changed

Lines changed: 5 additions & 15 deletions

File tree

openedx/core/djangoapps/content/search/management/commands/reindex_studio.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,14 +73,14 @@ def handle(self, *args, **options):
7373
raise CommandError("Meilisearch is not enabled. Please set MEILISEARCH_ENABLED to True in your settings.")
7474

7575
if options["reset"]:
76-
raise CommandError(
76+
log.warning(
7777
"The --reset flag has been removed. "
7878
"Index reset is now handled automatically by post_migrate reconciliation. "
7979
"Run: ./manage.py cms migrate"
8080
)
8181

8282
if options["init"]:
83-
raise CommandError(
83+
log.warning(
8484
"The --init flag has been removed. "
8585
"Index initialization is now handled automatically by post_migrate reconciliation. "
8686
"Run: ./manage.py cms migrate"

openedx/core/djangoapps/content/search/tests/test_reindex_cmd.py

Lines changed: 3 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -39,25 +39,15 @@ def test_disabled(self):
3939
with pytest.raises(CommandError, match="not enabled"):
4040
call_command("reindex_studio")
4141

42-
def test_reset_flag_removed(self):
43-
"""Passing --reset raises a clear error."""
44-
with pytest.raises(CommandError, match="--reset flag has been removed"):
45-
call_command("reindex_studio", "--reset")
46-
47-
def test_init_flag_removed(self):
48-
"""Passing --init raises a clear error."""
49-
with pytest.raises(CommandError, match="--init flag has been removed"):
50-
call_command("reindex_studio", "--init")
51-
5242
@patch("openedx.core.djangoapps.content.search.tasks.rebuild_index_incremental.delay")
5343
@patch("openedx.core.djangoapps.content.search.management.commands.reindex_studio.log")
5444
def test_incremental_flag_accepted_with_warning(self, mock_log, mock_delay):
55-
"""Passing --incremental logs a warning but still enqueues the task."""
45+
"""Passing old flags logs a warning but still enqueues the task."""
5646
mock_delay.return_value = Mock(id="fake-task-id")
5747

58-
call_command("reindex_studio", "--incremental")
48+
call_command("reindex_studio", "--incremental", "--init", "--experimental", "--reset")
5949

60-
mock_log.warning.assert_called_once()
50+
assert mock_log.warning.call_count == 4
6151
mock_delay.assert_called_once_with()
6252

6353

0 commit comments

Comments
 (0)