-
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
Aerospike migrations module #49138
Aerospike migrations module #49138
Conversation
Hi @Alb0t, thank you for submitting this pull-request! |
The test
|
d9c1537
to
b4f07d6
Compare
8fc1e02
to
8dc65a9
Compare
The test
The test
|
ready_for_review |
bot_status |
Componentslib/ansible/modules/database/aerospike/init.py lib/ansible/modules/database/aerospike/aerospike_migrations.py Metadatawaiting_on: maintainer |
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.
I'll continue with the second part tomorrow.
8dc65a9
to
405b2fc
Compare
) | ||
|
||
if module.check_mode: | ||
return result |
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.
You should always use module.exit_json()
or module.jail_json()
to return.
Also, this implementation of check_mode
looks strange. A check_mode
run should behave like a proper run from what it returns (if that can be determined in a reasonable way), with the exception that no change is made.
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.
Does the fail_json code on 215 not look right?
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.
That one's ok. Just using return
is not, though :)
result['message'] = "No migrations" | ||
else: | ||
result['message'] = skip_reason | ||
module.fail_json( |
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.
I would change this to module.fail_json(msg="Failed.", skip_reason=skip_reason)
, so that skip_reason
is returned explicitly.
# a bool to specify checking local node only or entire cluster | ||
has_migrations, skip_reason = migrations.has_migs(module.params['local_only']) | ||
if not has_migrations: | ||
result['message'] = "No migrations" |
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.
I don't think you need to return this fixed string on success. Just not returning anything should be fine.
Also, you might want to reduce your existing commit count (by squashing some of them together). Especially when you rebase anyway :) |
405b2fc
to
d8ce3b7
Compare
welp, i failed at squash. |
ready_for_review |
The good thing is, you can try again the next time ;) |
ready_for_review |
exception handling
c85bff8
to
78badbe
Compare
ready_for_review |
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
(Like I said before, I'm not an aerospike user, so I didn't test this, but the code looks good. Assuming that @Alb0t did test it, it's fine to merge this for me.)
thanks @felixfontein for all the help! We're using this actively in production with AWX. It's beautiful |
bot_status |
Componentslib/ansible/modules/database/aerospike/init.py lib/ansible/modules/database/aerospike/aerospike_migrations.py Metadatawaiting_on: maintainer |
You need at least one more review before this can get merged. You could for example bring your PR up in a Public Ansible Meeting on IRC (Freenode); see ansible/community#418 for details. @gundalow might also have some ideas :) |
Thanks Felix. I dropped it into ansible/community#418 and will be on the core meeting Tuesday at 19:00 UTC ! :) |
rebuild_merge |
* Push aerospike migrations module * maxsplit only valid for python3 exception handling
SUMMARY
Aerospike is a shared-nothing NoSQL database which is typically ran against 10-120 servers. With the typical replication and redundancy being able to withstand the loss of a limited amount of servers at a time, we need a module that allows us to check for replication or 'migrations' is complete to ensure data availability - before taking a system down. This ansible module should solve that need.
ISSUE TYPE
COMPONENT NAME
aerospike_migrations module
ADDITIONAL INFORMATION
More info on Migrations:
https://www.aerospike.com/docs/operations/manage/migration/