-
Notifications
You must be signed in to change notification settings - Fork 23.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Added support to create and delete multiple databases in MySQL #58602
Conversation
4849a52
to
07d59b0
Compare
f79c2f2
to
9e16c4a
Compare
9e16c4a
to
7dfdef0
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please rework the logic using the lists. I'll take another look then.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@pratikgadiya12 , thank you for this PR!
Let's start from covering these changes by integration tests. Then I make code and doc reviews.
- First of all, regarding that @felixfontein said , please, remove tests in a comma-separated form or a list form (on your choice) from the test file because they are interchangeable
- We should check:
- Create multiple databases check_mode (done)
- Create multiple databases (partially done) - you check it by:
"'database%' not in mysql_result.stdout"
it may return true when one db exists, but we need to be sure that the both databases exist, so, better to check them by names - Delete multiple databases check_mode (done)
- Delete multiple databases (done)
- Recreate multiple databases (done)
Please add checks for the following case:
- As I wrote above, when we check that the databases exist on the server instance we need to be sure that each of them exists, change it please (preferably by check them by names).
- Delete one of the databases, result.changed == true
- Check that it doesn't exist and the second db exists
- Try to create both in check_mode, result.changed == true
- Check that the deleted db actually doesn't exist, the second exist
- Try to create both again in actual mode, result.changed == true
- Check that the both exist
- Remove both databases to clean up
test/integration/targets/mysql_db/tasks/multi_db_create_delete.yml
Outdated
Show resolved
Hide resolved
test/integration/targets/mysql_db/tasks/multi_db_create_delete.yml
Outdated
Show resolved
Hide resolved
Thanks for the review @felixfontein and @Andersson007! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
shipit
@pratikgadiya12 thanks for the contribution, great work, thanks! |
Thanks a lot @felixfontein and @Andersson007 for great review! We could merge this @felixfontein since this PR has 2 shipit's from you guys :) |
!needs_revision |
bot_status |
Componentschangelogs/fragments/58370-mysqldb-allow-multiple_databases_create_delete_operation.yml docs/docsite/rst/porting_guides/porting_guide_2.9.rst lib/ansible/modules/database/mysql/mysql_db.py test/integration/targets/mysql_db/tasks/main.yml test/integration/targets/mysql_db/tasks/multi_db_create_delete.yml test/integration/targets/mysql_db/tasks/state_dump_import.yml Metadatawaiting_on: pratikgadiya12 |
shipit |
@pratikgadiya12 thanks a lot for implementing this! |
SUMMARY
Creation/Deletion of multiple databases now supported in MySQL
Fixes: #58370
ISSUE TYPE
COMPONENT NAME
lib/ansible/modules/database/mysql/mysql_db.py