We are currently refactoring the digitalocean modules (not use an external library, migrate everything to the v2 API).
all modules (do_droplet, do_tag, do_sshkey, do_domain, do_storage) will need some common code.
The most basic stuff is just a simplification of invoking fetch_url:
- Authentication handling
- common base URL
- common response/error handling
- JSON-fying data
- handling the “paging” of the API responses
We would love to place this in some common “digitalocean” module. But as far as I can see that would have to be placed in ‘ansible’ itself
(e.g. in module_utils/urls.py). Is there any mechanism to keep the common part in ansible-modules-core?
On the other hand everything (besides the paging stuff) might be useful to other projects as well.
So
- should we add some “Rest” stuff to urls.py in ‘ansible’?
- Is it possible to keep that in a do_common module/something in ‘ansible-modules-core’?