Skip to content
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

Merged
merged 2 commits into from
Jan 15, 2019
Merged

Conversation

Alb0t
Copy link
Contributor

@Alb0t Alb0t commented Nov 26, 2018

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
  • Feature Pull Request
COMPONENT NAME

aerospike_migrations module

ADDITIONAL INFORMATION

More info on Migrations:
https://www.aerospike.com/docs/operations/manage/migration/


PLAY [upgrade aerospike] *********************************************************************************************************************************************************************************************************************

TASK [Gathering Facts] ***********************************************************************************************************************************************************************************************************************
ok: [192.168.50.15]

TASK [Install dependencies] ******************************************************************************************************************************************************************************************************************
ok: [192.168.50.15]

TASK [setup aerospike] ***********************************************************************************************************************************************************************************************************************
ok: [192.168.50.15]

TASK [wait_for_migs] *************************************************************************************************************************************************************************************************************************
fatal: [192.168.50.15]: FAILED! => {"changed": false, "message": "Migrations still found after reaching limit.", "msg": "Migrations still found after reaching tries limit.", "original_message": ""}                                        
        to retry, use: --limit @/Users/alb0t/code/ansible_ansible/albot_ansible/test.retry

PLAY RECAP ***********************************************************************************************************************************************************************************************************************************
192.168.50.15              : ok=3    changed=0    unreachable=0    failed=1    skipped=0

(venv) alb0t @ ~/code/ansible_ansible/albot_ansible - [aerospike_migrations] $ ansible-playbook -i test.inv  test.yml -u root                                                                                                         

PLAY [upgrade aerospike] *********************************************************************************************************************************************************************************************************************

TASK [Gathering Facts] ***********************************************************************************************************************************************************************************************************************
ok: [192.168.50.15]

TASK [Install dependencies] ******************************************************************************************************************************************************************************************************************
ok: [192.168.50.15]

TASK [setup aerospike] ***********************************************************************************************************************************************************************************************************************
ok: [192.168.50.15]

TASK [wait_for_migs] *************************************************************************************************************************************************************************************************************************
ok: [192.168.50.15]

TASK [reboot] ********************************************************************************************************************************************************************************************************************************
^C

@ansibot
Copy link
Contributor

ansibot commented Nov 26, 2018

Hi @Alb0t, thank you for submitting this pull-request!

click here for bot help

@ansibot
Copy link
Contributor

ansibot commented Nov 26, 2018

The test ansible-test sanity --test validate-modules [explain] failed with 1 error:

lib/ansible/modules/database/aerospike/aerospike_migrations.py:0:0: E305 DOCUMENTATION.author: Invalid author for dictionary value @ data['author']. Got 'Albert Autin github.com/Alb0t'

click here for bot help

@ansibot ansibot added affects_2.8 This issue/PR affects Ansible v2.8 ci_verified Changes made in this PR are causing tests to fail. feature This issue/PR relates to a feature request. module This issue/PR relates to a module. needs_revision This PR fails CI tests or a maintainer has requested a review/revision of the PR. needs_triage Needs a first human triage before being processed. new_module This PR includes a new module. new_plugin This PR includes a new plugin. support:community This issue/PR relates to code supported by the Ansible community. labels Nov 26, 2018
@Alb0t Alb0t force-pushed the aerospike_migrations_module branch from d9c1537 to b4f07d6 Compare November 26, 2018 20:25
@ansibot ansibot removed the ci_verified Changes made in this PR are causing tests to fail. label Nov 26, 2018
@Alb0t Alb0t force-pushed the aerospike_migrations_module branch from 8fc1e02 to 8dc65a9 Compare November 26, 2018 21:09
@ansibot
Copy link
Contributor

ansibot commented Nov 26, 2018

The test ansible-test sanity --test pep8 [explain] failed with 1 error:

lib/ansible/modules/database/aerospike/aerospike_migrations.py:26:8: W291 trailing whitespace

The test ansible-test sanity --test validate-modules [explain] failed with 1 error:

lib/ansible/modules/database/aerospike/aerospike_migrations.py:0:0: E305 DOCUMENTATION.author: Invalid author for dictionary value @ data['author']. Got ['Albert Autin @Alb0t']

click here for bot help

@ansibot ansibot added community_review In order to be merged, this PR must follow the community review workflow. and removed needs_revision This PR fails CI tests or a maintainer has requested a review/revision of the PR. labels Nov 26, 2018
@Alb0t
Copy link
Contributor Author

Alb0t commented Nov 27, 2018

ready_for_review

@ansibot ansibot added the stale_ci This PR has been tested by CI more than one week ago. Close and re-open this PR to get it retested. label Dec 5, 2018
@Alb0t
Copy link
Contributor Author

Alb0t commented Dec 13, 2018

bot_status

@ansibot
Copy link
Contributor

ansibot commented Dec 13, 2018

Components

lib/ansible/modules/database/aerospike/init.py
support: community
maintainers:

lib/ansible/modules/database/aerospike/aerospike_migrations.py
support: community
maintainers:

Metadata

waiting_on: maintainer
changes_requested_by: null
needs_info: False
needs_revision: False
needs_rebase: False
merge_commits: []
too many files or commits: False
mergeable_state: clean
shippable_status: success
maintainer_shipits (module maintainers): 0
community_shipits (namespace maintainers): 0
ansible_shipits (core team members): 0
shipit_actors (maintainer or core team member): []
shipit_actors_other: []
automerge: automerge shipit test failed

click here for bot help

Copy link
Contributor

@felixfontein felixfontein left a 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.

@Alb0t Alb0t force-pushed the aerospike_migrations_module branch from 8dc65a9 to 405b2fc Compare December 14, 2018 23:23
@ansibot ansibot removed the stale_ci This PR has been tested by CI more than one week ago. Close and re-open this PR to get it retested. label Dec 15, 2018
)

if module.check_mode:
return result
Copy link
Contributor

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.

Copy link
Contributor Author

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?

Copy link
Contributor

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(
Copy link
Contributor

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"
Copy link
Contributor

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.

@felixfontein
Copy link
Contributor

Also, you might want to reduce your existing commit count (by squashing some of them together). Especially when you rebase anyway :)

@Alb0t Alb0t force-pushed the aerospike_migrations_module branch from 405b2fc to d8ce3b7 Compare December 19, 2018 08:36
@Alb0t
Copy link
Contributor Author

Alb0t commented Dec 19, 2018

welp, i failed at squash.

@Alb0t
Copy link
Contributor Author

Alb0t commented Dec 19, 2018

ready_for_review

@felixfontein
Copy link
Contributor

welp, i failed at squash.

The good thing is, you can try again the next time ;)

@ansibot ansibot added needs_ci This PR requires CI testing to be performed. Please close and re-open this PR to trigger CI. stale_ci This PR has been tested by CI more than one week ago. Close and re-open this PR to get it retested. and removed needs_ci This PR requires CI testing to be performed. Please close and re-open this PR to trigger CI. stale_ci This PR has been tested by CI more than one week ago. Close and re-open this PR to get it retested. labels Dec 27, 2018
@Alb0t
Copy link
Contributor Author

Alb0t commented Dec 27, 2018

ready_for_review

@Alb0t Alb0t force-pushed the aerospike_migrations_module branch from c85bff8 to 78badbe Compare January 1, 2019 20:46
@Alb0t
Copy link
Contributor Author

Alb0t commented Jan 1, 2019

ready_for_review

@ansibot ansibot added the stale_ci This PR has been tested by CI more than one week ago. Close and re-open this PR to get it retested. label Jan 10, 2019
Copy link
Contributor

@felixfontein felixfontein left a 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.)

@Alb0t
Copy link
Contributor Author

Alb0t commented Jan 13, 2019

thanks @felixfontein for all the help! We're using this actively in production with AWX. It's beautiful

@Alb0t
Copy link
Contributor Author

Alb0t commented Jan 13, 2019

bot_status

@ansibot
Copy link
Contributor

ansibot commented Jan 13, 2019

Components

lib/ansible/modules/database/aerospike/init.py
support: community
maintainers:

lib/ansible/modules/database/aerospike/aerospike_migrations.py
support: community
maintainers:

Metadata

waiting_on: maintainer
changes_requested_by: null
needs_info: False
needs_revision: False
needs_rebase: False
merge_commits: []
too many files or commits: False
mergeable_state: clean
shippable_status: success
maintainer_shipits (module maintainers): 0
community_shipits (namespace maintainers): 0
ansible_shipits (core team members): 1
shipit_actors (maintainers or core team members): felixfontein
shipit_actors_other: []
automerge: automerge shipit test failed

click here for bot help

@felixfontein
Copy link
Contributor

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 :)

@Alb0t
Copy link
Contributor Author

Alb0t commented Jan 14, 2019

Thanks Felix. I dropped it into ansible/community#418 and will be on the core meeting Tuesday at 19:00 UTC ! :)

@bcoca
Copy link
Member

bcoca commented Jan 15, 2019

rebuild_merge

@ansibot ansibot added shipit This PR is ready to be merged by Core and removed community_review In order to be merged, this PR must follow the community review workflow. stale_ci This PR has been tested by CI more than one week ago. Close and re-open this PR to get it retested. labels Jan 15, 2019
@ansibot ansibot merged commit 066ea55 into ansible:devel Jan 15, 2019
@sivel sivel removed the needs_triage Needs a first human triage before being processed. label Jan 15, 2019
knumskull pushed a commit to knumskull/ansible that referenced this pull request Jan 21, 2019
* Push aerospike migrations module

* maxsplit only valid for python3

exception handling
@ansible ansible locked and limited conversation to collaborators Jul 22, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
affects_2.8 This issue/PR affects Ansible v2.8 feature This issue/PR relates to a feature request. module This issue/PR relates to a module. new_module This PR includes a new module. new_plugin This PR includes a new plugin. shipit This PR is ready to be merged by Core support:community This issue/PR relates to code supported by the Ansible community.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants