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

Rewrite docker_container to use Docker API directly #422

Merged
merged 38 commits into from
Jul 15, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
38 commits
Select commit Hold shift + click to select a range
6705655
Begin experiments for docker_container rewrite.
felixfontein Jul 3, 2022
0a249c9
Continued.
felixfontein Jul 3, 2022
47ddcad
We support API >= 1.25 only anyway.
felixfontein Jul 3, 2022
b6d2bb4
Continued.
felixfontein Jul 3, 2022
216be8b
Fix bugs.
felixfontein Jul 3, 2022
b96c108
Complete first basic implementation.
felixfontein Jul 7, 2022
535374b
Continuing.
felixfontein Jul 8, 2022
b4f54cb
Improvements and fixes.
felixfontein Jul 9, 2022
1a85e3a
Continuing.
felixfontein Jul 10, 2022
ba0ffff
More 'easy' options.
felixfontein Jul 10, 2022
d74da30
More options.
felixfontein Jul 10, 2022
41d6e6f
Work on volumes and mounts.
felixfontein Jul 10, 2022
608d464
Add more options.
felixfontein Jul 10, 2022
062bb3f
The last option.
felixfontein Jul 10, 2022
139ef71
Copy over.
felixfontein Jul 10, 2022
16f63ee
Fix exposed ports.
felixfontein Jul 10, 2022
42178cf
Fix bugs.
felixfontein Jul 10, 2022
235afbb
Fix command and entrypoint.
felixfontein Jul 11, 2022
a49cbb5
More fixes.
felixfontein Jul 11, 2022
e04017f
Fix more bugs.
felixfontein Jul 11, 2022
2a17ab7
ci_complete
felixfontein Jul 11, 2022
c6476d4
Lint, fix Python 2.7 bugs, work around ansible-test bug.
felixfontein Jul 11, 2022
322c024
Remove no longer applicable test.
felixfontein Jul 11, 2022
325e451
Remove unnecessary ignore.
felixfontein Jul 11, 2022
d43b4a3
Start with engine driver.
felixfontein Jul 11, 2022
7d820bb
Refactoring.
felixfontein Jul 11, 2022
999b702
Avoid using anything Docker specific from self.client.
felixfontein Jul 11, 2022
5e31484
Refactor.
felixfontein Jul 12, 2022
bcdccbd
Add Python 2.6 ignore.txt entries for ansible-core < 2.12.
felixfontein Jul 12, 2022
e714d8d
Improve healthcheck handling.
felixfontein Jul 12, 2022
5677d30
Fix container removal logic.
felixfontein Jul 12, 2022
04df1b2
ci_complete
felixfontein Jul 12, 2022
1a7d03a
Remove handling of older Docker SDK for Pyhon versions from integrati…
felixfontein Jul 14, 2022
7f9b43c
Avoid recreation if a pure update is possible without losing the diff…
felixfontein Jul 14, 2022
fe790a0
Cover the case that blkio_weight does not work.
felixfontein Jul 14, 2022
d012dff
Update plugins/module_utils/module_container/docker_api.py
felixfontein Jul 14, 2022
5d7370a
Improve memory_swap tests.
felixfontein Jul 14, 2022
89bf3da
Fix URLs in changelog fragment.
felixfontein Jul 14, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions changelogs/fragments/docker_container.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
major_changes:
- "docker_container - no longer uses the Docker SDK for Python. It requires ``requests`` to be installed,
and depending on the features used has some more requirements. If the Docker SDK for Python is installed,
these requirements are likely met (https://github.com/ansible-collections/community.docker/pull/422)."
- "docker_container - the module was completely rewritten from scratch (https://github.com/ansible-collections/community.docker/pull/422)."
breaking_changes:
- "docker_container - ``publish_all_ports`` is no longer ignored in ``comparisons`` (https://github.com/ansible-collections/community.docker/pull/422)."
- "docker_container - ``exposed_ports`` is no longer ignored in ``comparisons``. Before, its value was assumed to be identical with the value of ``published_ports`` (https://github.com/ansible-collections/community.docker/pull/422)."
- "docker_container - ``log_options`` can no longer be specified when ``log_driver`` is not specified (https://github.com/ansible-collections/community.docker/pull/422)."
- "docker_container - ``restart_retries`` can no longer be specified when ``restart_policy`` is not specified (https://github.com/ansible-collections/community.docker/pull/422)."
- "docker_container - ``stop_timeout`` is no longer ignored for idempotency if told to be not ignored in ``comparisons``. So far it defaulted to ``ignore`` there, and setting it to ``strict`` had no effect (https://github.com/ansible-collections/community.docker/pull/422)."
3 changes: 3 additions & 0 deletions plugins/module_utils/_api/api/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -545,6 +545,9 @@ def delete_call(self, pathfmt, *args, **kwargs):
def delete_json(self, pathfmt, *args, **kwargs):
return self._result(self._delete(self._url(pathfmt, *args, versioned_api=True), **kwargs), json=True)

def post_call(self, pathfmt, *args, **kwargs):
self._raise_for_status(self._post(self._url(pathfmt, *args, versioned_api=True), **kwargs))

def post_json(self, pathfmt, *args, **kwargs):
data = kwargs.pop('data', None)
self._raise_for_status(self._post_json(self._url(pathfmt, *args, versioned_api=True), data, **kwargs))
Expand Down
5 changes: 3 additions & 2 deletions plugins/module_utils/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -557,8 +557,8 @@ def inspect_distribution(self, image, **kwargs):
class AnsibleDockerClient(AnsibleDockerClientBase):

def __init__(self, argument_spec=None, supports_check_mode=False, mutually_exclusive=None,
required_together=None, required_if=None, required_one_of=None, min_docker_version=None,
min_docker_api_version=None, option_minimal_versions=None,
required_together=None, required_if=None, required_one_of=None, required_by=None,
min_docker_version=None, min_docker_api_version=None, option_minimal_versions=None,
option_minimal_versions_ignore_params=None, fail_results=None):

# Modules can put information in here which will always be returned
Expand Down Expand Up @@ -588,6 +588,7 @@ def __init__(self, argument_spec=None, supports_check_mode=False, mutually_exclu
required_together=required_together_params,
required_if=required_if,
required_one_of=required_one_of,
required_by=required_by or {},
)

self.debug = self.module.params.get('debug')
Expand Down
3 changes: 2 additions & 1 deletion plugins/module_utils/common_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -467,7 +467,7 @@ def pull_image(self, name, tag="latest", platform=None):
class AnsibleDockerClient(AnsibleDockerClientBase):

def __init__(self, argument_spec=None, supports_check_mode=False, mutually_exclusive=None,
required_together=None, required_if=None, required_one_of=None,
required_together=None, required_if=None, required_one_of=None, required_by=None,
min_docker_api_version=None, option_minimal_versions=None,
option_minimal_versions_ignore_params=None, fail_results=None):

Expand Down Expand Up @@ -498,6 +498,7 @@ def __init__(self, argument_spec=None, supports_check_mode=False, mutually_exclu
required_together=required_together_params,
required_if=required_if,
required_one_of=required_one_of,
required_by=required_by or {},
)

self.debug = self.module.params.get('debug')
Expand Down
Loading