Commit Graph

563 Commits

Author SHA1 Message Date
Felix Fontein ad05773e34 Fix docs fragment. (#460) 2022-08-16 21:54:56 +02:00
Felix Fontein 9b8c10b8cf Move Fedora 35 from devel to stable-2.13 CI runs. (#458) 2022-08-16 21:41:36 +02:00
Felix Fontein 03ecea94c0 Prepare 3.0.2 release. 2022-08-16 13:48:02 +02:00
Evgeni Golov 91caf49988 correctly document incompatibility with Python 3.12+ (#454)
there was no, and there will not be, a Python 2.12 ;-)
2022-08-15 14:00:17 +02:00
Felix Fontein 6c9152567b Next expected release is 3.1.0. 2022-08-15 08:58:41 +02:00
Felix Fontein fbac2ecc3d Release 3.0.1. 3.0.1 2022-08-15 08:02:34 +02:00
Felix Fontein b720c8f486 Forgot to update copied version of deprecation notice. (#453) 2022-08-15 08:01:42 +02:00
Felix Fontein f7cf12555c docker_container: fix env_file option (#452)
* Add better tests for env and env_file.

* Make sure that non-container options are also passed to preprocessing code.

* Add changelog fragment.

* Add env_file override test.
2022-08-15 07:45:59 +02:00
Felix Fontein f9741b7457 Prepare 3.0.1 release. 2022-08-14 12:26:23 +02:00
Felix Fontein 9acc75be85 Next expected release is 3.1.0. 2022-08-12 22:35:33 +02:00
Felix Fontein be4f333696 Release 3.0.0. 3.0.0 2022-08-12 22:03:48 +02:00
Felix Fontein a50257381f Fix docker_plugin crash when handling plugin options (#447)
* Fix docker_plugin crash when handling plugin options.

* Try to add tests.
2022-08-12 19:29:45 +02:00
Felix Fontein f513ba2c59 Fix error formatting bug. (#448) 2022-08-12 13:53:59 +02:00
Felix Fontein 5b76f05bef Prepare 3.0.0 release. 2022-08-10 21:49:56 +02:00
Felix Fontein be58ccc13f Normalize booleans in all other plugins and modules. (#440) 2022-08-10 21:25:10 +02:00
Felix Fontein 1bf8da2390 Normalize booleans in docker_container docs. (#439) 2022-08-09 18:32:05 +02:00
Felix Fontein 74134eda33 Fix docker_container tests (#441)
* Add diff output to figure out a bit more why the test fails.

* Make sure that both images have been pulled in advance.

* Dump the correct image.

* Allow tty test to fail in certain circumstances.
2022-08-08 23:23:23 +02:00
Felix Fontein 1e4633a606 For Python > 2, always use shutil.which instead of custom Windows helper code. (#438)
This is related to
https://github.com/docker/docker-py/commit/42789818bed5d86b487a030e2e60b02bf0cfa284
in the sense that for Python > 2, we also exclusively use shutil.which now,
but we do not remove the helper function since we need it for Python 2 on Windows.

Co-authored-by: Daniel Möller <n1ngu@riseup.net>

Co-authored-by: Daniel Möller <n1ngu@riseup.net>
2022-08-08 20:58:12 +02:00
Felix Fontein bc6757d3b8 Fix docs. (#436) 2022-08-04 14:23:52 +02:00
Felix Fontein b2bb064e47 Release 3.0.0-rc2. 3.0.0-rc2 2022-07-31 17:50:47 +02:00
Felix Fontein da9b076904 Prepare 3.0.0-rc2. 2022-07-31 17:11:48 +02:00
Felix Fontein ae708a7333 Vendored Docker SDK for Python updates (#434)
* utils: fix IPv6 address w/ port parsing

This was using a deprecated function (`urllib.splitnport`),
ostensibly to work around issues with brackets on IPv6 addresses.

Ironically, its usage was broken, and would result in mangled IPv6
addresses if they had a port specified in some instances.

Usage of the deprecated function has been eliminated and extra test
cases added where missing. All existing cases pass as-is. (The only
other change to the test was to improve assertion messages.)

Cherry-picked from
https://github.com/docker/docker-py/commit/f16c4e1147c81afd822fe72191f0f720cb0ba637

Co-authored-by: Milas Bowman <milas.bowman@docker.com>

* client: fix exception semantics in _raise_for_status

We want "The above exception was the direct cause of the following exception:" instead of "During handling of the above exception, another exception occurred:"

Cherry-picked from
https://github.com/docker/docker-py/commit/bb11197ee3407798a53c50e43aa994fe8cd9c8e7

Co-authored-by: Maor Kleinberger <kmaork@gmail.com>

* tls: use auto-negotiated highest version

Specific TLS versions are deprecated in latest Python, which
causes test failures due to treating deprecation errors as
warnings.

Luckily, the fix here is straightforward: we can eliminate some
custom version selection logic by using `PROTOCOL_TLS_CLIENT`,
which is the recommended method and will select the highest TLS
version supported by both client and server.

Cherry-picked from
https://github.com/docker/docker-py/commit/56dd6de7dfad9bedc7c8af99308707ecc3fad78e

Co-authored-by: Milas Bowman <milas.bowman@docker.com>

* transport: fix ProxyCommand for SSH conn

Cherry-picked from
https://github.com/docker/docker-py/commit/4e19cc48dfd88d0a9a8bdbbe4df4357322619d02

Co-authored-by: Guy Lichtman <glicht@users.noreply.github.com>

* ssh: do not create unnecessary subshell on exec

Cherry-picked from
https://github.com/docker/docker-py/commit/bb40ba051fc67605d5c9e7fd1eb5f9aa3e0fb501

Co-authored-by: liubo <liubo@uniontech.com>

* ssh: reject unknown host keys when using Python SSH impl

In the Secure Shell (SSH) protocol, host keys are used to verify the identity of remote hosts. Accepting unknown host keys may leave the connection open to man-in-the-middle attacks.

Do not accept unknown host keys. In particular, do not set the default missing host key policy for the Paramiko library to either AutoAddPolicy or WarningPolicy. Both of these policies continue even when the host key is unknown. The default setting of RejectPolicy is secure because it throws an exception when it encounters an unknown host key.

Reference: https://cwe.mitre.org/data/definitions/295.html

NOTE: This only affects SSH connections using the native Python SSH implementation (Paramiko), when `use_ssh_client=False` (default). If using the system SSH client (`use_ssh_client=True`), the host configuration
(e.g. `~/.ssh/config`) will apply.

Cherry-picked from
https://github.com/docker/docker-py/commit/d9298647d91c52e1ee9ac448e43a7fea1c69bdbe

Co-authored-by: Audun Nes <audun.nes@gmail.com>

* lint: fix deprecation warnings from threading package

Set `daemon` attribute instead of using `setDaemon` method that
was deprecated in Python 3.10.

Cherry-picked from
https://github.com/docker/docker-py/commit/adf5a97b1203623ae47bf7aa1367b6bb7c261980

Co-authored-by: Karthikeyan Singaravelan <tir.karthi@gmail.com>

* api: preserve cause when re-raising error

Use `from e` to ensure that the error context is propagated
correctly.

Cherry-picked from
https://github.com/docker/docker-py/commit/05e143429e892fb838bbff058391456ba3d0a19c

Co-authored-by: Milas Bowman <milas.bowman@docker.com>

* build: trim trailing whitespace from dockerignore entries

Cherry-picked from
https://github.com/docker/docker-py/commit/3ee3a2486fe75ed858f8a3defe0fc79b2743d5df

Co-authored-by: Clément Loiselet <clement.loiselet@capgemini.com>

* Improve formulation, also mention the security change as a breaking change.

Co-authored-by: Milas Bowman <milas.bowman@docker.com>
Co-authored-by: Maor Kleinberger <kmaork@gmail.com>
Co-authored-by: Guy Lichtman <glicht@users.noreply.github.com>
Co-authored-by: liubo <liubo@uniontech.com>
Co-authored-by: Audun Nes <audun.nes@gmail.com>
Co-authored-by: Karthikeyan Singaravelan <tir.karthi@gmail.com>
Co-authored-by: Clément Loiselet <clement.loiselet@capgemini.com>
2022-07-31 17:09:18 +02:00
Maxwell G a33e51e04a Prefer unitest.mock by universally using compat.mock (#433)
* Prefer unitest.mock by using compat.mock

`mock` is a backport of the `unittest.mock` module from the stdlib, and
there's no reason to use it on newer Python versions. `mock` is deprecated
in Fedora, so I figured I'd propose this here before downstream patching
our ansible-collection-community-docker package.

* Remove compat.mock code for older Python 3 versions

This removes compatibility for older versions of Python 3 that are no
longer supported.
2022-07-31 16:39:31 +02:00
Felix Fontein e90647b209 Release 3.0.0-rc1. 3.0.0-rc1 2022-07-26 08:59:01 +02:00
Felix Fontein cc55aeb882 Prepare 3.0.0-rc1. 2022-07-26 08:28:25 +02:00
Felix Fontein 9c5d562c0e Fix bug when TLS is used (#432)
* Fix bug when TLS is used.

* Add HTTP/HTTPS connection test.
2022-07-26 08:25:53 +02:00
Felix Fontein 6caaa3a90b Release 3.0.0-a3. 3.0.0-a3 2022-07-23 15:21:05 +02:00
Felix Fontein ca3d7a3609 Prepare 3.0.0-a3 release. 2022-07-23 15:10:51 +02:00
Felix Fontein a4539a309e Move licenses to LICENSES/, use SPDX-License-Identifier, mention all licenses in galaxy.yml (#430)
* Move licenses to LICENSES/, use SPDX-License-Identifier, mention all licenses in galaxy.yml.

* ignore.txt lines cannot be empty or contain only a comment.

* Cleanup.

* This particular __init__.py seems to be crucial.

* Try extra newline.

* Markdown comments are a real mess. I hope this won't break Galaxy...

* More licenses.

* Add sanity test.

* Skip some files, lint.

* Make sure there is a copyright line everywhere.

* Also check for copyright line in sanity tests.

* Remove colon after 'Copyright'.

* Normalize lint script.

* Avoid colon after 'Copyright' in lint script.

* Improve license checker.

* Update README.md

Co-authored-by: Maxwell G <9920591+gotmax23@users.noreply.github.com>

* Remove superfluous space.

* Referencing target instead of symlink

Co-authored-by: Maxwell G <9920591+gotmax23@users.noreply.github.com>
2022-07-20 07:45:33 +02:00
Felix Fontein 0e3d7d4802 Release 3.0.0-a2. 3.0.0-a2 2022-07-15 19:28:10 +02:00
Felix Fontein e26890a909 Implement platform parameter for docker_container, first version. (#426) 2022-07-15 17:14:57 +02:00
Felix Fontein 5d0a036819 docker_container: add image_comparison parameter (#428)
* Add image_comparison parameter.

* Forgot version_added.
2022-07-15 17:14:40 +02:00
Felix Fontein 37c868e192 Add support for cgroupns_mode parameter. (#427) 2022-07-15 17:14:23 +02:00
Felix Fontein 2f1d9b3ff9 Prepare 3.0.0-a2 release. 2022-07-15 14:10:49 +02:00
Felix Fontein 77e63e2cca Rewrite docker_container to use Docker API directly (#422)
* Begin experiments for docker_container rewrite.

* Continued.

* We support API >= 1.25 only anyway.

* Continued.

* Fix bugs.

* Complete first basic implementation.

* Continuing.

* Improvements and fixes.

* Continuing.

* More 'easy' options.

* More options.

* Work on volumes and mounts.

* Add more options.

* The last option.

* Copy over.

* Fix exposed ports.

* Fix bugs.

* Fix command and entrypoint.

* More fixes.

* Fix more bugs.

* ci_complete

* Lint, fix Python 2.7 bugs, work around ansible-test bug.

ci_complete

* Remove no longer applicable test.

ci_complete

* Remove unnecessary ignore.

ci_complete

* Start with engine driver.

* Refactoring.

* Avoid using anything Docker specific from self.client.

* Refactor.

* Add Python 2.6 ignore.txt entries for ansible-core < 2.12.

* Improve healthcheck handling.

* Fix container removal logic.

* ci_complete

* Remove handling of older Docker SDK for Pyhon versions from integration tests.

* Avoid recreation if a pure update is possible without losing the diff data.

* Cover the case that blkio_weight does not work.

* Update plugins/module_utils/module_container/docker_api.py

Co-authored-by: Brian Scholer <1260690+briantist@users.noreply.github.com>

* Improve memory_swap tests.

* Fix URLs in changelog fragment.

Co-authored-by: Brian Scholer <1260690+briantist@users.noreply.github.com>
2022-07-15 07:24:14 +02:00
Felix Fontein 04121b5882 Rewrite docker_plugin to not use the Docker SDK for Python (#429)
* Rewrite the docker_plugin module to use the low-level client from Docker SDK for Python.

* Rewrite to no longer use the Docker SDK for Python.

* Remove Docker SDK for Python version from tests.
2022-07-14 16:29:37 +02:00
Felix Fontein c00b4ec9be Adjust to https://github.com/ansible/ansible/commit/b1dd2af4cac9df517ce8216eaa97e66c0b15d90a. (#423) 2022-07-12 17:01:50 +02:00
Felix Fontein f6d4cad46e Fix tests on Ubuntu 22.04 (#419)
* Try to fix tests on Ubuntu 22.04.

* Let Ansible handle the apt repo install.
2022-07-07 22:54:14 +02:00
Felix Fontein 58211153db Improve README (#418)
* List missing plugins.

* Fix short description.

* Improve section on requirements.

* Apply suggestions from code review

Co-authored-by: Don Naro <dnaro@redhat.com>

Co-authored-by: Don Naro <dnaro@redhat.com>
2022-07-07 13:56:48 +02:00
Felix Fontein b90cc8b3f9 Release 3.0.0-a1. 3.0.0-a1 2022-07-07 07:07:55 +02:00
Felix Fontein 848e21d253 Prepare 3.0.0-a1 release. 2022-07-06 22:40:00 +02:00
Felix Fontein da9252a67e Rewrite the docker_api connection plugin (#414)
* Rewrite the docker_api connection plugin.

* Improve formulation.

* Improve error messages.
2022-07-06 21:48:55 +02:00
Felix Fontein 23a90668c9 Rewrite the docker_containers inventory plugin (#413)
* Rewrite the docker_containers inventory plugin.

* Improve error messages.
2022-07-06 21:48:32 +02:00
Felix Fontein c3a76007d0 Rewrite the docker_volume_info module (#412)
* Rewrite the docker_volume_info module.

* Improve error messages.
2022-07-06 21:48:22 +02:00
Felix Fontein 6869eaf869 Rewrite the docker_volume module (#411)
* Rewrite the docker_volume module.

* Improve error messages.
2022-07-06 21:48:16 +02:00
Felix Fontein e60ce69102 Rewrite the docker_prune module (#410)
* Rewrite the docker_prune module.

* Improve error messages.
2022-07-06 21:47:43 +02:00
Felix Fontein 18fdd04782 Rewrite the docker_network_info module (#409)
* Rewrite the docker_network_info module.

* Improve error messages.
2022-07-06 21:47:37 +02:00
Felix Fontein 4c026307fb Rewrite the docker_network module (#408)
* Rewrite the docker_network module.

* Update plugins/modules/docker_network.py

Co-authored-by: Brian Scholer <1260690+briantist@users.noreply.github.com>

* Improve error messages.

Co-authored-by: Brian Scholer <1260690+briantist@users.noreply.github.com>
2022-07-06 21:47:32 +02:00
Felix Fontein a406b08981 Rewrite the docker_login module (#407)
* Rewrite the docker_login module.

* Improve error messages.
2022-07-06 21:47:27 +02:00
Felix Fontein f82c8401c2 Rewrite the docker_image_load module (#406)
* Rewrite the docker_image_load module.

* Improve error messages.
2022-07-06 21:46:19 +02:00