Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,16 @@ See the fragment files in the [changelog.d/ directory](./changelog.d).

<!-- scriv-insert-here -->

<a id='changelog-20.1.1'></a>
## 20.1.1 — 2025-12-04

### Fixed

- Adjust the drop-db command to properly handle replica set configuration if
available. Remove the Notes user if the Notes plugin is enabled.
- Avoid erroring when calling `iter_mfes` if the MFE plugin is not enabled.
Useful for testing with the minimal dependencies.

<a id='changelog-20.1.0'></a>
## v20.1.0 (2025-11-10)

Expand Down
64 changes: 52 additions & 12 deletions drydock/plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -245,21 +245,61 @@ def delete_dbs_command():

MONGO_DROP_COMMAND = """
mongosh \
{% if MONGODB_ROOT_USERNAME and MONGODB_ROOT_PASSWORD %} \
mongodb://{{ MONGODB_ROOT_USERNAME }}:{{ MONGODB_ROOT_PASSWORD }}@{{ MONGODB_HOST }}:{{ MONGODB_PORT }}/{{ MONGODB_DATABASE }}?authSource={{ MONGODB_AUTH_SOURCE }} --eval 'db.dropDatabase()'
{% else %} \
mongodb://{{ MONGODB_HOST }}:{{ MONGODB_PORT }}/{{ MONGODB_DATABASE }}?authSource={{ MONGODB_AUTH_SOURCE }} --eval 'db.dropDatabase()'
{% if 'forum' in PLUGINS %}
mongodb://{{ MONGODB_HOST }}:{{ MONGODB_PORT }}/{{ FORUM_MONGODB_DATABASE }}?authSource={{ MONGODB_AUTH_SOURCE }} --eval 'db.dropDatabase()'
{% endif %}
{% endif %}
--host {% if MONGODB_REPLICA_SET %}{{ MONGODB_REPLICA_SET }}/{% endif %}{{ MONGODB_HOST }} \
--port {{ MONGODB_PORT }} \
{% if MONGODB_ROOT_USERNAME %} \
--username {{ MONGODB_ROOT_USERNAME }} \
{% endif %} \
{% if MONGODB_ROOT_PASSWORD %} \
--password {{ MONGODB_ROOT_PASSWORD }} \
{% endif %} \
--authenticationDatabase {{ MONGODB_AUTH_SOURCE }} \
{% if MONGODB_USE_SSL %} --tls true {% endif %} \
{{ MONGODB_DATABASE }} \
--eval 'db.dropDatabase()'

{% if 'forum' in PLUGINS %}
mongosh \
--host {% if MONGODB_REPLICA_SET %}{{ MONGODB_REPLICA_SET }}/{% endif %}{{ MONGODB_HOST }} \
--port {{ MONGODB_PORT }} \
{% if MONGODB_ROOT_USERNAME %} \
--username {{ MONGODB_ROOT_USERNAME }} \
{% endif %} \
{% if MONGODB_ROOT_PASSWORD %} \
--password {{ MONGODB_ROOT_PASSWORD }} \
{% endif %} \
--authenticationDatabase {{ MONGODB_AUTH_SOURCE }} \
{% if MONGODB_USE_SSL %} --tls true {% endif %} \
{{ FORUM_MONGODB_DATABASE }} \
--eval 'db.dropDatabase()'
{% endif %}
"""
MYSQL_DROP_COMMAND = """
mysql -u {{ MYSQL_ROOT_USERNAME }} --password="{{ MYSQL_ROOT_PASSWORD }}" --host "{{ MYSQL_HOST }}" --port {{ MYSQL_PORT }} -e "DROP DATABASE IF EXISTS {{ OPENEDX_MYSQL_DATABASE }};"
mysql -u {{ MYSQL_ROOT_USERNAME }} --password="{{ MYSQL_ROOT_PASSWORD }}" --host "{{ MYSQL_HOST }}" --port {{ MYSQL_PORT }} -e "DROP USER IF EXISTS '{{ OPENEDX_MYSQL_USERNAME }}';"
mysql \
--user {{ MYSQL_ROOT_USERNAME }} \
--password="{{ MYSQL_ROOT_PASSWORD }}" \
--host "{{ MYSQL_HOST }}" \
--port {{ MYSQL_PORT }} \
--execute "DROP DATABASE IF EXISTS {{ OPENEDX_MYSQL_DATABASE }};"
mysql \
--user {{ MYSQL_ROOT_USERNAME }} \
--password="{{ MYSQL_ROOT_PASSWORD }}" \
--host "{{ MYSQL_HOST }}" \
--port {{ MYSQL_PORT }} \
--execute "DROP USER IF EXISTS '{{ OPENEDX_MYSQL_USERNAME }}';" \
{% if 'notes' in PLUGINS %}
mysql -u {{ MYSQL_ROOT_USERNAME }} --password="{{ MYSQL_ROOT_PASSWORD }}" --host "{{ MYSQL_HOST }}" --port {{ MYSQL_PORT }} -e 'DROP DATABASE IF EXISTS {{ NOTES_MYSQL_DATABASE }};'
mysql -u {{ MYSQL_ROOT_USERNAME }} --password="{{ MYSQL_ROOT_PASSWORD }}" --host "{{ MYSQL_HOST }}" --port {{ MYSQL_PORT }} -e "DROP USER IF EXISTS '{{ NOTES_MYSQL_USERNAME }}';"
mysql \
--user {{ MYSQL_ROOT_USERNAME }} \
--password="{{ MYSQL_ROOT_PASSWORD }}" \
--host "{{ MYSQL_HOST }}" \
--port {{ MYSQL_PORT }} \
--execute 'DROP DATABASE IF EXISTS {{ NOTES_MYSQL_DATABASE }};' \
mysql \
--user {{ MYSQL_ROOT_USERNAME }} \
--password="{{ MYSQL_ROOT_PASSWORD }}" \
--host "{{ MYSQL_HOST }}" \
--port {{ MYSQL_PORT }} \
--execute 'DROP USER IF EXISTS {{ NOTES_MYSQL_USERNAME }};' \
{% endif %}
"""
do_callback(
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[project]
name = "tutor-contrib-drydock"
version = "20.1.0"
version = "20.1.1"
description = "A Tutor plugin to manage our opinionated Open edX operations"
readme = "README.md"
requires-python = ">=3.10"
Expand Down
2 changes: 1 addition & 1 deletion uv.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.