-
Notifications
You must be signed in to change notification settings - Fork 24k
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
mysql_replication: add option to fail on error #66252
Conversation
The test
The test
|
0973ad6
to
12d3efe
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.
first of all, we need to:
- use
module.fail_json
instead ofraise
- a changelog fragment, see here
- create integrations tests for the case by putting your options somewhere to
test/integration/targets/mysql_replication/tasks/
with explicitfail_on_error: yes|no
invocation - add an example of using the option to the
EXAMPLE =r'''
section
fail_on_error: | ||
description: | ||
- Fails on error when calling mysql. | ||
- This is the "expected" behaviour if you want to rely on MySQL replication working. |
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.
- This is the "expected" behaviour if you want to rely on MySQL replication working. |
why is there the double quotes? Anyway, IMO this is extra information
@petoju are you working on this? |
12d3efe
to
d73508d
Compare
@Andersson007 yes, I missed the message. Changes are pushed here now - I could not run the tests now as I'm on slow Internet and it needs some MBs of images. |
The test
|
d73508d
to
5a0ad77
Compare
5a0ad77
to
c3b8b78
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.
LGTM, @petoju thank you! @bmalynovytch is it OK? (for me it looks reasonable but i'm not a guru of MySQL)
shipit
@petoju Thx for the contrib ! |
@bmalynovytch that's a really good point and it revealed a flaw in my code that I'll try to fix over the weekend. As I omitted the background, there are 3 interesting states of task execution:
It is really annoying, when one uses ansible and has to verify, whether execution really happened or there was some hidden error. |
c3b8b78
to
1ebd5bc
Compare
1ebd5bc
to
f264c12
Compare
It should be fixed and tested now - mysql warnings still cause exceptions in current configuration (that I didn't expect). So warnings are fine now and report "ok" state now even with this option being turned on. |
@petoju it is usually not good to push changes forcelly, difficult to track them between commits |
@bmalynovytch , waiting for your confirmation |
Sorry for amending, some projects have rules of one commit per PR. More
changes here will be separate commits.
Dňa pi 31. 1. 2020, 8:31 Andrew Klychkov <notifications@github.com>
napísal(a):
… @petoju <https://github.com/petoju> it is usually not good to push
changes forcelly, difficult to track them between commits
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#66252?email_source=notifications&email_token=AAXINWFCGWJHKFCOCWL7H6TRAPHWDA5CNFSM4KD5PNC2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEKNYTTI#issuecomment-580618701>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAXINWHCNPLZUGW2YTNGEQTRAPHWDANCNFSM4KD5PNCQ>
.
|
@petoju , no problem and there are no rules:) thanks for the PR. |
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.
LGTM
shipit
@petoju could you close and reopen this pr. to see it merged we need to get rid of |
Closing PR as requested. |
@Andersson007 that PR is in #67322 now. |
@petoju you didn’t need to open the new one instead, just to open again this one would be enough and ok to trigger the bot to relaunch the tests. |
SUMMARY
Module mysql_replication is not failing when error happens on some command call. Add a backwards compatible option to fail in such situation.
ISSUE TYPE
COMPONENT NAME
mysql_replication
ADDITIONAL INFORMATION
Without my change:
With my change, one will have ability to specify fail_on_error. I am scared to make breaking change (as this could break some users), so I am adding an option to fail, when an error happens.
That said, I don't know all error conditions and it's possible there are some cases, when the call fails on python level, but will be successful from user's POV.