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

New module docker_plugin #95

Merged
merged 9 commits into from
Mar 1, 2021
Merged

Conversation

sakar97
Copy link
Contributor

@sakar97 sakar97 commented Feb 27, 2021

SUMMARY

This module introduces docker plugin features. User can perform the following task with this module:
1- Create/Remove a Plugin
2- Enable/Disable the Plugin
3- Change the settings of a plugin

TODO
1- Functionality to upgrade the plugin
2- Add Integration test for plugin-options.

Fixes #74

ISSUE TYPE
  • New Module Pull Request
COMPONENT NAME

docker_plugin

ADDITIONAL INFORMATION

This module was already started in 2019 ansible/ansible#52643
Docker SDK is used from here https://docker-py.readthedocs.io/en/stable/plugins.html

- name: Create a plugin
  docker_plugin:
    plugin_name: "{{ plugin_name }}"
    state: present
  register: create_1

Copy link
Collaborator

@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.

Thanks a lot for picking up the docker_plugin module! I've added a few first comments.

tests/integration/targets/docker_plugin/aliases Outdated Show resolved Hide resolved
plugins/modules/docker_plugin.py Outdated Show resolved Hide resolved
plugins/modules/docker_plugin.py Show resolved Hide resolved
plugins/modules/docker_plugin.py Outdated Show resolved Hide resolved
plugins/modules/docker_plugin.py Show resolved Hide resolved
plugins/modules/docker_plugin.py Outdated Show resolved Hide resolved
plugins/modules/docker_plugin.py Outdated Show resolved Hide resolved
plugins/modules/docker_plugin.py Outdated Show resolved Hide resolved
plugins/modules/docker_plugin.py Outdated Show resolved Hide resolved
plugins/modules/docker_plugin.py Outdated Show resolved Hide resolved
Copy link
Collaborator

@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.

The following changes are needed to make check mode work correctly.

Check mode should be mostly identical to the real plugin behavior, except that the actual Docker SDK for Python calls are not done. Everything else - reporting changes, reporting actions - should be done as if check mode is not enabled.

plugins/modules/docker_plugin.py Outdated Show resolved Hide resolved
plugins/modules/docker_plugin.py Outdated Show resolved Hide resolved
plugins/modules/docker_plugin.py Outdated Show resolved Hide resolved
plugins/modules/docker_plugin.py Outdated Show resolved Hide resolved
@felixfontein
Copy link
Collaborator

(Sorry, that was one too much. I deleted it, you might need to reload so that it actually vanishes for you.)

@felixfontein
Copy link
Collaborator

If you want to run the integration tests manually: ansible-test integration --docker ubuntu2004 -v docker_plugin

(This requires that you checked out the repository so that Ansible can use it, see https://docs.ansible.com/ansible/devel/dev_guide/developing_collections.html#contributing-to-collections for details.)

Copy link
Collaborator

@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.

Looks good! I've found two details in the tests, but besides that I think it's ready (as much as I can judge):

@sakar97
Copy link
Contributor Author

sakar97 commented Feb 28, 2021

Fixed! @felixfontein Thanks for the Review.

@felixfontein felixfontein merged commit da62cfc into ansible-collections:main Mar 1, 2021
@felixfontein
Copy link
Collaborator

@porshkevich thanks for contributing the first version of this module!
@sakar97 thanks for finishing the new module!
@WojciechowskiPiotr thanks for reviewing (the old PR, but still ;) )!

@sakar97 sakar97 deleted the 74 branch March 4, 2021 15:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Create docker_plugin module
2 participants